Skip to content

Commit 64ae8a2

Browse files
committed
Separate cgetfile from window logic
1 parent 319a8b2 commit 64ae8a2

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

autoload/dispatch.vim

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ function! dispatch#complete(file) abort
825825
endif
826826
echo label '!'.request.expanded s:postfix(request)
827827
if !request.background
828-
call s:cgetfile(request, 0, status)
828+
call s:cwindow(request, 0, status)
829829
redraw
830830
endif
831831
endif
@@ -843,15 +843,15 @@ function! dispatch#copen(bang) abort
843843
if !dispatch#completed(request) && filereadable(request.file . '.complete')
844844
let request.completed = 1
845845
endif
846-
call s:cgetfile(request, a:bang, -2)
846+
call s:cwindow(request, a:bang, -2)
847847
endfunction
848848

849849
function! s:is_quickfix(...) abort
850850
let nr = a:0 ? a:1 : winnr()
851851
return getwinvar(nr, '&buftype') ==# 'quickfix' && empty(getloclist(nr))
852852
endfunction
853853

854-
function! s:cgetfile(request, all, copen) abort
854+
function! s:cgetfile(request, ...) abort
855855
let request = s:request(a:request)
856856
let efm = &l:efm
857857
let makeprg = &l:makeprg
@@ -863,7 +863,7 @@ function! s:cgetfile(request, all, copen) abort
863863
let &modelines = 0
864864
call s:set_current_compiler(get(request, 'compiler', ''))
865865
exe cd fnameescape(request.directory)
866-
if a:all
866+
if a:0 && a:1
867867
let &l:efm = '%+G%.%#'
868868
else
869869
let &l:efm = request.format
@@ -884,6 +884,10 @@ function! s:cgetfile(request, all, copen) abort
884884
let &l:makeprg = makeprg
885885
call s:set_current_compiler(compiler)
886886
endtry
887+
endfunction
888+
889+
function! s:cwindow(request, all, copen)
890+
call s:cgetfile(a:request, a:all)
887891
let height = get(g:, 'dispatch_quickfix_height', 10)
888892
let was_qf = s:is_quickfix()
889893
execute 'botright' (a:copen ? 'copen' : 'cwindow') height

0 commit comments

Comments
 (0)