@@ -209,21 +209,8 @@ function! s:create_syn_match()
209
209
return ' '
210
210
endfunction
211
211
212
- let s: _funcname = ' \(rgb\|hsl\)a\?' " submatch 1
213
- let s: _numval = ' \(\d\{1,3}%\?\)' " submatch 2,3,4
214
- let s: _ws_ = ' \s*'
215
- let s: _listsep = s: _ws_ . ' ,' . s: _ws_
216
- let s: _otherargs_ = ' \%(,[^)]*\)\?'
217
- let s: _funcexpr = s: _funcname . ' [(]' . s: _numval . s: _listsep . s: _numval . s: _listsep . s: _numval . s: _ws_ . s: _otherargs_ . ' [)]'
218
- let s: _hexcolor = ' #\(\x\{3}\|\x\{6}\)\>' " submatch 5
219
- let s: _grammar = s: _funcexpr . ' \|' . s: _hexcolor
220
- function ! css_color#parse_screen ()
221
- " N.B. this substitute() call is here just for the side effect
222
- " of invoking s:create_syn_match during substitution -- because
223
- " match() and friends do not allow finding all matches in a single
224
- " scan without examining the start of the string over and over
225
- call substitute ( join ( getline (' w0' ,' w$' ), " \n " ), s: _grammar , ' \=s:create_syn_match()' , ' g' )
226
-
212
+ function ! s: update_matches ()
213
+ " adds matches based that duplicate the highlighted colors on the current line
227
214
let lnr = line (' .' )
228
215
let group = ' '
229
216
let groupstart = 0
@@ -241,3 +228,20 @@ function! css_color#parse_screen()
241
228
let groupstart = col
242
229
endfor
243
230
endfunction
231
+
232
+ let s: _funcname = ' \(rgb\|hsl\)a\?' " submatch 1
233
+ let s: _numval = ' \(\d\{1,3}%\?\)' " submatch 2,3,4
234
+ let s: _ws_ = ' \s*'
235
+ let s: _listsep = s: _ws_ . ' ,' . s: _ws_
236
+ let s: _otherargs_ = ' \%(,[^)]*\)\?'
237
+ let s: _funcexpr = s: _funcname . ' [(]' . s: _numval . s: _listsep . s: _numval . s: _listsep . s: _numval . s: _ws_ . s: _otherargs_ . ' [)]'
238
+ let s: _hexcolor = ' #\(\x\{3}\|\x\{6}\)\>' " submatch 5
239
+ let s: _grammar = s: _funcexpr . ' \|' . s: _hexcolor
240
+ function ! css_color#parse_screen ()
241
+ " N.B. this substitute() call is here just for the side effect
242
+ " of invoking s:create_syn_match during substitution -- because
243
+ " match() and friends do not allow finding all matches in a single
244
+ " scan without examining the start of the string over and over
245
+ call substitute ( join ( getline (' w0' ,' w$' ), " \n " ), s: _grammar , ' \=s:create_syn_match()' , ' g' )
246
+ call s: update_matches ()
247
+ endfunction
0 commit comments