diff options
author | w0rp <w0rp@users.noreply.github.com> | 2017-03-24 21:04:49 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-24 21:04:49 +0000 |
commit | 822b19ac8376677d73c4df5ce80ed708a1cabd8b (patch) | |
tree | 413453f240d753f8a80591d4acf2cfb8dafa9aa6 | |
parent | a5ac3e4e4b66360f4309c77e03d63fa580658a12 (diff) | |
parent | b3f6f56745f5d288bcf64c8e284ef314ec3e9e30 (diff) | |
download | ale-822b19ac8376677d73c4df5ce80ed708a1cabd8b.zip |
Merge pull request #411 from lucaskolstad/lint_on_enter_bugfix
#272 Check if quickfix window is open before reopening
-rw-r--r-- | autoload/ale/list.vim | 10 | ||||
-rw-r--r-- | test/test_list_opening.vader | 8 |
2 files changed, 14 insertions, 4 deletions
diff --git a/autoload/ale/list.vim b/autoload/ale/list.vim index 6486d906..63d51ab5 100644 --- a/autoload/ale/list.vim +++ b/autoload/ale/list.vim @@ -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). diff --git a/test/test_list_opening.vader b/test/test_list_opening.vader index 942f592f..6d0164fd 100644 --- a/test/test_list_opening.vader +++ b/test/test_list_opening.vader @@ -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 @@ -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 |