@@ -172,23 +172,27 @@ else
172172 function ! s: HighlightEOLWhitespace ()
173173 call <SID> ClearHighlighting ()
174174 if <SID> ShouldHighlight ()
175- let s: match_id = matchadd (' ExtraWhitespace' , s: eol_whitespace_pattern , 10 , get (s: , ' match_id' , -1 ))
175+ let w: better_whitespace_match_id = matchadd (' ExtraWhitespace' ,
176+ \ s: eol_whitespace_pattern , 10 , get (s: , ' better_whitespace_match_id' , -1 ))
176177 endif
177178 endfunction
178179
179180 " Match Whitespace on all lines except the current one
180181 function ! s: HighlightEOLWhitespaceExceptCurrentLine ()
181182 call <SID> ClearHighlighting ()
182183 if <SID> ShouldHighlight ()
183- let s: match_id = matchadd (' ExtraWhitespace' ,
184+ let w: better_whitespace_match_id = matchadd (' ExtraWhitespace' ,
184185 \ ' \%<' . line (' .' ) . ' l' . s: eol_whitespace_pattern .
185- \ ' \|\%>' . line (' .' ) . ' l' . s: eol_whitespace_pattern , 10 , get (s: , ' match_id ' , -1 ))
186+ \ ' \|\%>' . line (' .' ) . ' l' . s: eol_whitespace_pattern , 10 , get (s: , ' better_whitespace_match_id ' , -1 ))
186187 endif
187188 endfunction
188189
189190 " Remove Whitespace matching
190191 function ! s: ClearHighlighting ()
191- silent ! call matchdelete (get (s: , ' match_id' , -1 ))
192+ let match_id = get (w: , ' better_whitespace_match_id' , -1 )
193+ if match_id >= 0
194+ call matchdelete (match_id)
195+ endif
192196 endfunction
193197endif
194198
0 commit comments