Skip to content

Commit

Permalink
Merge pull request #411 from lucaskolstad/lint_on_enter_bugfix
Browse files Browse the repository at this point in the history
#272 Check if quickfix window is open before reopening
  • Loading branch information
w0rp authored Mar 24, 2017
2 parents a5ac3e4 + b3f6f56 commit 822b19a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
10 changes: 6 additions & 4 deletions autoload/ale/list.vim
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ function! ale#list#SetLists(buffer, loclist) abort
if len(a:loclist) > 0 || g:ale_keep_list_window_open
let l:winnr = winnr()

if g:ale_set_quickfix
copen
elseif g:ale_set_loclist
lopen
if !ale#list#IsQuickfixOpen()
if g:ale_set_quickfix
copen
elseif g:ale_set_loclist
lopen
endif
endif

" If focus changed, restore it (jump to the last window).
Expand Down
8 changes: 8 additions & 0 deletions test/test_list_opening.vader
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ Execute(The quickfix window should open for just the loclist):
call ale#list#SetLists(bufnr('%'), g:loclist)
Assert ale#list#IsQuickfixOpen()

" Clear the list and it should close again.
call ale#list#SetLists(bufnr('%'), [])
Assert !ale#list#IsQuickfixOpen()

Execute(The quickfix window should stay open for just the loclist):
let g:ale_open_list = 1
let g:ale_keep_list_window_open = 1
Expand Down Expand Up @@ -76,6 +80,10 @@ Execute(The quickfix window should open for the quickfix list):
call ale#list#SetLists(bufnr('%'), g:loclist)
Assert ale#list#IsQuickfixOpen()

" Clear the list and it should close again.
call ale#list#SetLists(bufnr('%'), [])
Assert !ale#list#IsQuickfixOpen()

Execute(The quickfix window should stay open for the quickfix list):
let g:ale_set_quickfix = 1
let g:ale_open_list = 1
Expand Down

0 comments on commit 822b19a

Please sign in to comment.