summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-06-02 19:02:48 +0100
committerw0rp <devw0rp@gmail.com>2017-06-02 19:21:45 +0100
commit76b5c9283da30f90acadda0da3b77534909c88d7 (patch)
tree1ed1eca106d39cdbb55bb7a3c3f3d60612c978c6
parent9b6d6344b21d5eabee9c958b95bb81ed0631d604 (diff)
downloadale-76b5c9283da30f90acadda0da3b77534909c88d7.zip
#574 Do not restore items with no columns for highlights from hidden buffersv1.3.1
-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 f3a479e3..5e4cbdb0 100644
--- a/autoload/ale/highlight.vim
+++ b/autoload/ale/highlight.vim
@@ -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
diff --git a/test/test_highlight_placement.vader b/test/test_highlight_placement.vader
index 25c98784..b5816852 100644
--- a/test/test_highlight_placement.vader
+++ b/test/test_highlight_placement.vader
@@ -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('%'),