Skip to content

Commit 359c628

Browse files
committed
Report Success/Failure in the quickfix title
1 parent 250ea26 commit 359c628

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

autoload/dispatch.vim

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,14 @@ function! s:postfix(request) abort
374374
return '(' . a:request.handler.'/'.(!empty(pid) ? pid : '?') . ')'
375375
endfunction
376376

377+
function! s:status_label(request) abort
378+
let label = get(a:request, 'label', '') . get(a:request, 'status', '')
379+
if !empty(label)
380+
return '(' . label . ')'
381+
endif
382+
return ''
383+
endfunction
384+
377385
function! s:echo_truncated(left, right) abort
378386
if exists('v:echospace')
379387
let max_len = (&cmdheight - 1) * &columns + v:echospace
@@ -1209,10 +1217,6 @@ function! dispatch#complete(file, ...) abort
12091217
if !a:0
12101218
silent doautocmd ShellCmdPost
12111219
endif
1212-
if !request.background && !get(request, 'aborted')
1213-
call s:cwindow(request, 0, status, '', 'make')
1214-
redraw!
1215-
endif
12161220
if has_key(request, 'aborted')
12171221
echohl DispatchAbortedMsg
12181222
let label = 'Aborted:'
@@ -1226,6 +1230,12 @@ function! dispatch#complete(file, ...) abort
12261230
echohl DispatchCompleteMsg
12271231
let label = 'Complete:'
12281232
endif
1233+
let request.label = label
1234+
let request.status = status
1235+
if !request.background && !get(request, 'aborted')
1236+
call s:cwindow(request, 0, status, '', 'make')
1237+
redraw!
1238+
endif
12291239
call s:echo_truncated(label . '!', request.expanded . ' ' . s:postfix(request))
12301240
echohl NONE
12311241
if !a:0
@@ -1310,13 +1320,14 @@ function! s:cgetfile(request, event, ...) abort
13101320
if len(a:event)
13111321
exe 'silent doautocmd QuickFixCmdPre' a:event
13121322
endif
1313-
if exists(':chistory') && get(getqflist({'title': 1}), 'title', '') ==# title
1323+
if exists(':chistory') && stridx(get(getqflist({'title': 1}), 'title', ''), title) >= 0
13141324
call setqflist([], 'r')
13151325
execute 'noautocmd caddfile' dispatch#fnameescape(request.file)
13161326
else
13171327
execute 'noautocmd cgetfile' dispatch#fnameescape(request.file)
13181328
endif
13191329
if exists(':chistory')
1330+
let title .= ' ' . s:status_label(request)
13201331
call setqflist([], 'r', {'title': title})
13211332
endif
13221333
if len(a:event)

0 commit comments

Comments
 (0)