diff --git a/autoload/dispatch.vim b/autoload/dispatch.vim index 7dca508..016dcab 100644 --- a/autoload/dispatch.vim +++ b/autoload/dispatch.vim @@ -371,15 +371,12 @@ endfunction function! s:postfix(request) abort let pid = dispatch#pid(a:request) - return '(' . a:request.handler.'/'.(!empty(pid) ? pid : '?') . ')' + let label = get(a:request, 'label', 'Running') + return '(' . (!empty(pid) ? pid : '?') . '/' . label . ')' endfunction -function! s:status_label(request) abort - let label = get(a:request, 'label', '') . get(a:request, 'status', '') - if !empty(label) - return '(' . label . ')' - endif - return '' +function! s:quickfix_title(request) abort + return ':Dispatch '.dispatch#escape(a:request.expanded) . ' ' . s:postfix(a:request) endfunction function! s:echo_truncated(left, right) abort @@ -1219,24 +1216,22 @@ function! dispatch#complete(file, ...) abort endif if has_key(request, 'aborted') echohl DispatchAbortedMsg - let label = 'Aborted:' + let request.label = 'Aborted' elseif status > 0 echohl DispatchFailureMsg - let label = 'Failure:' + let request.label = 'Failure' elseif status == 0 echohl DispatchSuccessMsg - let label = 'Success:' + let request.label = 'Success' else echohl DispatchCompleteMsg - let label = 'Complete:' + let request.label = 'Complete' endif - let request.label = label - let request.status = status if !request.background && !get(request, 'aborted') call s:cwindow(request, 0, status, '', 'make') redraw! endif - call s:echo_truncated(label . '!', request.expanded . ' ' . s:postfix(request)) + call s:echo_truncated('!', request.expanded . ' ' . s:postfix(request)) echohl NONE if !a:0 checktime @@ -1316,18 +1311,18 @@ function! s:cgetfile(request, event, ...) abort let &l:efm = request.format endif let &l:makeprg = dispatch#escape(request.expanded) - let title = ':Dispatch '.dispatch#escape(request.expanded) . ' ' . s:postfix(request) if len(a:event) exe 'silent doautocmd QuickFixCmdPre' a:event endif - if exists(':chistory') && stridx(get(getqflist({'title': 1}), 'title', ''), title) >= 0 + let title = s:quickfix_title(request) + let title_to_match = title[:strridx(title, '/')] + if exists(':chistory') && stridx(get(getqflist({'title': 1}), 'title', ''), title_to_match) >= 0 call setqflist([], 'r') execute 'noautocmd caddfile' dispatch#fnameescape(request.file) else execute 'noautocmd cgetfile' dispatch#fnameescape(request.file) endif if exists(':chistory') - let title .= ' ' . s:status_label(request) call setqflist([], 'r', {'title': title}) endif if len(a:event)