Fix some broken logic gathering highlights

Before, we would break the loop if we hit a highlight group with an
empty name.  In that case, we should actually continue the loop.
I moved the loop index increment to the beginning of the loop to make
this easier.
This commit is contained in:
Matt Wozniski 2008-09-17 13:09:43 -04:00
parent 7b00efcb8f
commit 94d110f5a5

View File

@ -182,12 +182,19 @@ endfunction
function! s:Highlights()
let rv = {}
let i = 1
let i = 0
while 1
if synIDtrans(i) == 0 || !len(synIDattr(synIDtrans(i), "name"))
let i += 1
" Only interested in groups that exist and aren't linked
if synIDtrans(i) == 0
break
endif
" Handle vim bug allowing groups with name == "" to be created
if synIDtrans(i) != i || len(synIDattr(i, "name")) == 0
continue
endif
if !has_key(rv, synIDtrans(i))
let group = {}
let group.name = synIDattr(synIDtrans(i), "name")
@ -218,8 +225,6 @@ function! s:Highlights()
let rv[synIDtrans(i)] = group
endif
let i += 1
endwhile
return rv