From 94d110f5a588bab278c7ae562296d76db282c02b Mon Sep 17 00:00:00 2001 From: Matt Wozniski Date: Wed, 17 Sep 2008 13:09:43 -0400 Subject: [PATCH] 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. --- plugin/CSApprox.vim | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/plugin/CSApprox.vim b/plugin/CSApprox.vim index ec97909..3e4dec9 100644 --- a/plugin/CSApprox.vim +++ b/plugin/CSApprox.vim @@ -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