Skip to content

Commit afaacf5

Browse files
committed
ensure matches are cleared before creating new ones
This fixes ap#90.
1 parent 1b0f83d commit afaacf5

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

autoload/css_color.vim

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,17 +179,17 @@ endfunction
179179

180180
function! s:clear_matches()
181181
call map(get(w:, 'css_color_match_id', []), 'matchdelete(v:val)')
182-
unlet! w:css_color_match_id
182+
let w:css_color_match_id = []
183183
endfunction
184184

185185
function! s:create_matches()
186+
call s:clear_matches()
186187
if ! &l:cursorline | return | endif
187188
" adds matches based that duplicate the highlighted colors on the current line
188189
let lnr = line('.')
189190
let group = ''
190191
let groupstart = 0
191192
let endcol = col('$')
192-
let w:css_color_match_id = []
193193
for col in range( 1, endcol )
194194
let nextgroup = col < endcol ? synIDattr( synID( lnr, col, 1 ), 'name' ) : ''
195195
if group == nextgroup | continue | endif
@@ -218,7 +218,6 @@ let s:_csscolor = s:_hexcolor . '\|' . s:_funcexpr
218218
" match() and friends do not allow finding all matches in a single
219219
" scan without examining the start of the string over and over
220220
function! s:parse_screen()
221-
call s:clear_matches()
222221
let leftcol = winsaveview().leftcol
223222
let left = max([ leftcol - 15, 0 ])
224223
let width = &columns * 4

0 commit comments

Comments
 (0)