Fix #746 - Keep highlights from other plugins when buffers are hidden
This commit is contained in:
parent
6a84605c57
commit
82dd80c692
@ -669,7 +669,7 @@ function! ale#engine#Cleanup(buffer) abort
|
||||
|
||||
if g:ale_set_highlights
|
||||
call ale#highlight#UnqueueHighlights(a:buffer)
|
||||
call ale#highlight#RemoveHighlights([])
|
||||
call ale#highlight#RemoveHighlights()
|
||||
endif
|
||||
|
||||
call remove(g:ale_buffer_info, a:buffer)
|
||||
|
@ -69,7 +69,7 @@ endfunction
|
||||
|
||||
" Given a loclist for current items to highlight, remove all highlights
|
||||
" except these which have matching loclist item entries.
|
||||
function! ale#highlight#RemoveHighlights(loclist) abort
|
||||
function! ale#highlight#RemoveHighlights() abort
|
||||
for l:match in s:GetALEMatches()
|
||||
call matchdelete(l:match.id)
|
||||
endfor
|
||||
@ -81,7 +81,7 @@ function! ale#highlight#UpdateHighlights() abort
|
||||
let l:loclist = l:has_new_items ? remove(s:buffer_highlights, l:buffer) : []
|
||||
|
||||
if l:has_new_items || !g:ale_enabled
|
||||
call ale#highlight#RemoveHighlights(l:loclist)
|
||||
call ale#highlight#RemoveHighlights()
|
||||
endif
|
||||
|
||||
" Restore items from the map of hidden items,
|
||||
@ -131,7 +131,7 @@ function! ale#highlight#BufferHidden(buffer) abort
|
||||
\ 'v:val.bufnr == a:buffer && v:val.col > 0'
|
||||
\)
|
||||
|
||||
call clearmatches()
|
||||
call ale#highlight#RemoveHighlights()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
@ -120,17 +120,32 @@ Execute(Only ALE highlights should be restored when buffers are restored):
|
||||
|
||||
call matchaddpos('SomeOtherGroup', [[1, 1, 1]])
|
||||
|
||||
" We should have one more match here.
|
||||
AssertEqual 2, len(GetMatchesWithoutIDs()), 'The highlights weren''t initially set!'
|
||||
" We should have both highlights.
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {'group': 'ALEError', 'priority': 10, 'pos1': [3, 2, 1]},
|
||||
\ {'group': 'SomeOtherGroup', 'priority': 10, 'pos1': [1, 1, 1]},
|
||||
\ ],
|
||||
\ GetMatchesWithoutIDs()
|
||||
|
||||
call ale#highlight#BufferHidden(bufnr('%'))
|
||||
|
||||
AssertEqual 0, len(GetMatchesWithoutIDs()), 'The highlights weren''t cleared!'
|
||||
" We should remove our highlight, but not the other one.
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {'group': 'SomeOtherGroup', 'priority': 10, 'pos1': [1, 1, 1]}
|
||||
\ ],
|
||||
\ GetMatchesWithoutIDs()
|
||||
|
||||
call ale#highlight#UpdateHighlights()
|
||||
|
||||
" Only our matches should appear again.
|
||||
AssertEqual 1, len(GetMatchesWithoutIDs()), 'The highlights weren''t set again!'
|
||||
" Our highlight should apper again.
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {'group': 'SomeOtherGroup', 'priority': 10, 'pos1': [1, 1, 1]},
|
||||
\ {'group': 'ALEError', 'priority': 10, 'pos1': [3, 2, 1]},
|
||||
\ ],
|
||||
\ GetMatchesWithoutIDs()
|
||||
|
||||
Execute(Higlight end columns should set an appropriate size):
|
||||
call ale#highlight#SetHighlights(bufnr('%'), [
|
||||
|
Loading…
Reference in New Issue
Block a user