Skip to content

Commit

Permalink
Revert "Prevent errors instead of silencing (#153)" (#155)
Browse files Browse the repository at this point in the history
This reverts commit ab46827.
Mitigating #154.
  • Loading branch information
ntpeters authored Jun 30, 2022
1 parent ab46827 commit 1b22dc5
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions plugin/better-whitespace.vim
Original file line number Diff line number Diff line change
Expand Up @@ -172,27 +172,23 @@ else
function! s:HighlightEOLWhitespace()
call <SID>ClearHighlighting()
if <SID>ShouldHighlight()
let w:better_whitespace_match_id = matchadd('ExtraWhitespace',
\ s:eol_whitespace_pattern, 10, get(s:, 'better_whitespace_match_id', -1))
let s:match_id = matchadd('ExtraWhitespace', s:eol_whitespace_pattern, 10, get(s:, 'match_id', -1))
endif
endfunction

" Match Whitespace on all lines except the current one
function! s:HighlightEOLWhitespaceExceptCurrentLine()
call <SID>ClearHighlighting()
if <SID>ShouldHighlight()
let w:better_whitespace_match_id = matchadd('ExtraWhitespace',
let s:match_id = matchadd('ExtraWhitespace',
\ '\%<' . line('.') . 'l' . s:eol_whitespace_pattern .
\ '\|\%>' . line('.') . 'l' . s:eol_whitespace_pattern, 10, get(s:, 'better_whitespace_match_id', -1))
\ '\|\%>' . line('.') . 'l' . s:eol_whitespace_pattern, 10, get(s:, 'match_id', -1))
endif
endfunction

" Remove Whitespace matching
function! s:ClearHighlighting()
let match_id = get(w:, 'better_whitespace_match_id', -1)
if match_id >= 0
call matchdelete(match_id)
endif
silent! call matchdelete(get(s:, 'match_id', -1))
endfunction
endif

Expand Down

0 comments on commit 1b22dc5

Please sign in to comment.