Skip to content

Commit 8cf4b21

Browse files
authored
Handle new buffer types: popups (#129)
* Disable in floating windows by default * Fix highlighting disabled on popup close Close #128
1 parent 4afbd45 commit 8cf4b21

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

plugin/better-whitespace.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ endif
120120
function! s:ShouldHighlight()
121121
" Guess from the filetype if a) not locally decided, b) globally enabled, c) there is enough information
122122
if !exists('b:better_whitespace_enabled') && g:better_whitespace_enabled == 1 && !(empty(&buftype) && empty(&filetype))
123-
let b:better_whitespace_enabled = &buftype != 'nofile' && index(g:better_whitespace_filetypes_blacklist, &ft) == -1
123+
let b:better_whitespace_enabled = &buftype != 'nofile' && &buftype != 'popup' && index(g:better_whitespace_filetypes_blacklist, &ft) == -1
124124
endif
125125
return get(b:, 'better_whitespace_enabled', g:better_whitespace_enabled)
126126
endfunction
@@ -341,7 +341,7 @@ function! <SID>SetupAutoCommands()
341341

342342
if g:current_line_whitespace_disabled_soft == 0
343343
" Using syntax: clear whitespace highlighting when leaving buffer
344-
autocmd BufWinLeave * call <SID>ClearHighlighting()
344+
autocmd BufWinLeave * if expand("<afile>") == expand("%") | call <SID>ClearHighlighting() | endif
345345

346346
" Do not highlight whitespace on current line in insert mode
347347
autocmd CursorMovedI * call <SID>HighlightEOLWhitespaceExceptCurrentLine()

0 commit comments

Comments
 (0)