#574 Do not restore items with no columns for highlights from hidden buffers

This commit is contained in:
w0rp 2017-06-02 19:02:48 +01:00
parent 9b6d6344b2
commit 76b5c9283d
2 changed files with 7 additions and 1 deletions

View file

@ -109,7 +109,11 @@ function! ale#highlight#BufferHidden(buffer) abort
endif
endfor
let s:buffer_restore_map[a:buffer] = l:loclist
let s:buffer_restore_map[a:buffer] = filter(
\ copy(l:loclist),
\ 'v:val.bufnr == a:buffer && v:val.col > 0'
\)
call clearmatches()
endif
endfunction

View file

@ -96,8 +96,10 @@ Execute(Highlights set by ALE should be removed when buffer cleanup is done):
Execute(Highlights should be cleared when buffers are hidden):
call ale#engine#InitBufferInfo(bufnr('%'))
" The second item should be ignored, as it has no column infomration.
let g:ale_buffer_info[bufnr('%')].loclist = [
\ {'bufnr': bufnr('%'), 'type': 'E', 'lnum': 3, 'col': 2},
\ {'bufnr': bufnr('%'), 'type': 'E', 'lnum': 4, 'col': 0},
\]
call ale#highlight#SetHighlights(
\ bufnr('%'),