Skip to content

Commit d5da31c

Browse files
committed
Extract quickfix window check
1 parent 13f2aa8 commit d5da31c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

autoload/dispatch.vim

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -839,6 +839,11 @@ function! dispatch#copen(bang) abort
839839
call s:cgetfile(request, a:bang, 1)
840840
endfunction
841841

842+
function! s:is_quickfix(...) abort
843+
let nr = a:0 ? a:1 : winnr()
844+
return getwinvar(nr, '&buftype') ==# 'quickfix' && empty(getloclist(nr))
845+
endfunction
846+
842847
function! s:cgetfile(request, all, copen) abort
843848
let request = s:request(a:request)
844849
let efm = &l:efm
@@ -873,9 +878,9 @@ function! s:cgetfile(request, all, copen) abort
873878
call s:set_current_compiler(compiler)
874879
endtry
875880
let height = get(g:, 'dispatch_quickfix_height', 10)
876-
let was_qf = &buftype ==# 'quickfix' && empty(getloclist(0))
881+
let was_qf = s:is_quickfix()
877882
execute 'botright' (a:copen ? 'copen' : 'cwindow') height
878-
if !was_qf && !a:copen && &buftype ==# 'quickfix' && empty(getloclist(0))
883+
if !was_qf && !a:copen && s:is_quickfix()
879884
wincmd p
880885
endif
881886
endfunction

0 commit comments

Comments
 (0)