summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--autoload/ale/list.vim34
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/