summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--autoload/ale/highlight.vim6
-rw-r--r--test/test_highlight_placement.vader2
2 files changed, 7 insertions, 1 deletions
diff --git a/autoload/ale/highlight.vim b/autoload/ale/highlight.vim
index d63e7166..80e43526 100644
--- a/autoload/ale/highlight.vim
+++ b/autoload/ale/highlight.vim
@@ -164,7 +164,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
diff --git a/test/test_highlight_placement.vader b/test/test_highlight_placement.vader
index 6764dffe..a134916f 100644
--- a/test/test_highlight_placement.vader
+++ b/test/test_highlight_placement.vader
@@ -98,8 +98,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('%'),