Skip to content

Commit 1b22dc5

Browse files
authored
Revert "Prevent errors instead of silencing (#153)" (#155)
This reverts commit ab46827. Mitigating #154.
1 parent ab46827 commit 1b22dc5

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

plugin/better-whitespace.vim

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -172,27 +172,23 @@ else
172172
function! s:HighlightEOLWhitespace()
173173
call <SID>ClearHighlighting()
174174
if <SID>ShouldHighlight()
175-
let w:better_whitespace_match_id = matchadd('ExtraWhitespace',
176-
\ s:eol_whitespace_pattern, 10, get(s:, 'better_whitespace_match_id', -1))
175+
let s:match_id = matchadd('ExtraWhitespace', s:eol_whitespace_pattern, 10, get(s:, 'match_id', -1))
177176
endif
178177
endfunction
179178

180179
" Match Whitespace on all lines except the current one
181180
function! s:HighlightEOLWhitespaceExceptCurrentLine()
182181
call <SID>ClearHighlighting()
183182
if <SID>ShouldHighlight()
184-
let w:better_whitespace_match_id = matchadd('ExtraWhitespace',
183+
let s:match_id = matchadd('ExtraWhitespace',
185184
\ '\%<' . line('.') . 'l' . s:eol_whitespace_pattern .
186-
\ '\|\%>' . line('.') . 'l' . s:eol_whitespace_pattern, 10, get(s:, 'better_whitespace_match_id', -1))
185+
\ '\|\%>' . line('.') . 'l' . s:eol_whitespace_pattern, 10, get(s:, 'match_id', -1))
187186
endif
188187
endfunction
189188

190189
" Remove Whitespace matching
191190
function! s:ClearHighlighting()
192-
let match_id = get(w:, 'better_whitespace_match_id', -1)
193-
if match_id >= 0
194-
call matchdelete(match_id)
195-
endif
191+
silent! call matchdelete(get(s:, 'match_id', -1))
196192
endfunction
197193
endif
198194

0 commit comments

Comments
 (0)