Skip to content

Commit 822b19a

Browse files
authored
Merge pull request #411 from lucaskolstad/lint_on_enter_bugfix
#272 Check if quickfix window is open before reopening
2 parents a5ac3e4 + b3f6f56 commit 822b19a

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

autoload/ale/list.vim

+6-4
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,12 @@ function! ale#list#SetLists(buffer, loclist) abort
3636
if len(a:loclist) > 0 || g:ale_keep_list_window_open
3737
let l:winnr = winnr()
3838

39-
if g:ale_set_quickfix
40-
copen
41-
elseif g:ale_set_loclist
42-
lopen
39+
if !ale#list#IsQuickfixOpen()
40+
if g:ale_set_quickfix
41+
copen
42+
elseif g:ale_set_loclist
43+
lopen
44+
endif
4345
endif
4446

4547
" If focus changed, restore it (jump to the last window).

test/test_list_opening.vader

+8
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ Execute(The quickfix window should open for just the loclist):
4949
call ale#list#SetLists(bufnr('%'), g:loclist)
5050
Assert ale#list#IsQuickfixOpen()
5151

52+
" Clear the list and it should close again.
53+
call ale#list#SetLists(bufnr('%'), [])
54+
Assert !ale#list#IsQuickfixOpen()
55+
5256
Execute(The quickfix window should stay open for just the loclist):
5357
let g:ale_open_list = 1
5458
let g:ale_keep_list_window_open = 1
@@ -76,6 +80,10 @@ Execute(The quickfix window should open for the quickfix list):
7680
call ale#list#SetLists(bufnr('%'), g:loclist)
7781
Assert ale#list#IsQuickfixOpen()
7882

83+
" Clear the list and it should close again.
84+
call ale#list#SetLists(bufnr('%'), [])
85+
Assert !ale#list#IsQuickfixOpen()
86+
7987
Execute(The quickfix window should stay open for the quickfix list):
8088
let g:ale_set_quickfix = 1
8189
let g:ale_open_list = 1

0 commit comments

Comments
 (0)