diff options
author | w0rp <w0rp@users.noreply.github.com> | 2019-06-08 23:25:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-08 23:25:02 +0100 |
commit | 59829bc194ac95f67396f47fb90048afc70537c8 (patch) | |
tree | 2f41d37b2ac69938363c674b1a8884d18128d2d1 | |
parent | d9931b98910a64b81499ef9ae9d95ac4d446c67f (diff) | |
parent | 8b0879212f8771f79cd3233e8a4f829c93d05915 (diff) | |
download | ale-59829bc194ac95f67396f47fb90048afc70537c8.zip |
Merge pull request #2253 from jj-kim/master
Improve location list behavior on split windows of same buffer.
-rw-r--r-- | autoload/ale/list.vim | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/autoload/ale/list.vim b/autoload/ale/list.vim index 63d97f35..80a30216 100644 --- a/autoload/ale/list.vim +++ b/autoload/ale/list.vim @@ -71,8 +71,8 @@ function! s:FixList(buffer, list) abort return l:new_list endfunction -function! s:BufWinId(buffer) abort - return exists('*bufwinid') ? bufwinid(str2nr(a:buffer)) : 0 +function! s:WinFindBuf(buffer) abort + return exists('*win_findbuf') ? win_findbuf(str2nr(a:buffer)) : [0] endfunction function! s:SetListsImpl(timer_id, buffer, loclist) abort @@ -88,17 +88,19 @@ function! s:SetListsImpl(timer_id, buffer, loclist) abort call setqflist([], 'r', {'title': l:title}) endif elseif g:ale_set_loclist - " If windows support is off, bufwinid() may not exist. + " If windows support is off, win_findbuf() may not exist. " We'll set result in the current window, which might not be correct, " but it's better than nothing. - let l:id = s:BufWinId(a:buffer) - - if has('nvim') - call setloclist(l:id, s:FixList(a:buffer, a:loclist), ' ', l:title) - else - call setloclist(l:id, s:FixList(a:buffer, a:loclist)) - call setloclist(l:id, [], 'r', {'title': l:title}) - endif + let l:ids = s:WinFindBuf(a:buffer) + + for l:id in l:ids + if has('nvim') + call setloclist(l:id, s:FixList(a:buffer, a:loclist), ' ', l:title) + else + call setloclist(l:id, s:FixList(a:buffer, a:loclist)) + call setloclist(l:id, [], 'r', {'title': l:title}) + endif + endfor endif " Open a window to show the problems if we need to. @@ -181,11 +183,13 @@ function! s:CloseWindowIfNeeded(buffer) abort cclose endif else - let l:win_id = s:BufWinId(a:buffer) + let l:win_ids = s:WinFindBuf(a:buffer) - if g:ale_set_loclist && empty(getloclist(l:win_id)) - lclose - endif + for l:win_id in l:win_ids + if g:ale_set_loclist && empty(getloclist(l:win_id)) + lclose + endif + endfor endif " Ignore 'Cannot close last window' errors. catch /E444/ |