commit 601bf2e225af61bd64440f841f6d64dbb3d95be5 (tree)
parent fad16e502a02c6ea8dda0d8269a9cf961885f688
Author: Tim Pope <code@tpope.net>
Date: Sat, 27 Feb 2021 08:18:28 -0500
Provide some <mods> handling on quickfix commands
Most notably, don't force an early redraw with :silent.
Closes https://github.com/tpope/vim-fugitive/issues/1685
Diffstat:
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim
@@ -626,7 +626,8 @@ function! s:QuickfixCreate(nr, opts) abort
endif
endfunction
-function! s:QuickfixStream(nr, event, title, cmd, first, callback, ...) abort
+function! s:QuickfixStream(nr, event, title, cmd, first, mods, callback, ...) abort
+ let mods = s:Mods(a:mods)
let opts = {'title': a:title, 'context': {'items': []}}
call s:QuickfixCreate(a:nr, opts)
let event = (a:nr < 0 ? 'c' : 'l') . 'fugitive-' . a:event
@@ -647,7 +648,9 @@ function! s:QuickfixStream(nr, event, title, cmd, first, callback, ...) abort
call extend(opts.context.items, contexts)
unlet contexts
call s:QuickfixSet(a:nr, remove(buffer, 0, -1), 'a')
- redraw
+ if mods !~# '\<silent\>'
+ redraw
+ endif
endif
endfor
call extend(buffer, call(a:callback, a:000 + [0]))
@@ -658,7 +661,7 @@ function! s:QuickfixStream(nr, event, title, cmd, first, callback, ...) abort
silent exe s:DoAutocmd('QuickFixCmdPost ' . event)
if a:first && len(s:QuickfixGet(a:nr))
call s:BlurStatus()
- return a:nr < 0 ? 'cfirst' : 'lfirst'
+ return mods . (a:nr < 0 ? 'cfirst' : 'lfirst')
else
return 'exe'
endif
@@ -4053,7 +4056,7 @@ function! s:ToolStream(line1, line2, range, bang, mods, options, args, state) ab
let exec += a:options.flags + ['--no-pager', 'diff', '--no-ext-diff', '--no-color', '--no-prefix'] + argv
if prompt
let title = ':Git ' . s:fnameescape(a:options.flags + [a:options.command] + a:options.args)
- return s:QuickfixStream(a:line2, 'difftool', title, exec, !a:bang, s:function('s:ToolParse'), a:state)
+ return s:QuickfixStream(a:line2, 'difftool', title, exec, !a:bang, a:mods, s:function('s:ToolParse'), a:state)
else
let filename = ''
let cmd = []
@@ -4436,7 +4439,7 @@ function! fugitive#LogCommand(line1, count, range, bang, mods, args, type) abort
if empty(paths + extra_paths) && empty(a:type) && a:count < 0 && len(s:Relative('/'))
let after = '|echohl WarningMsg|echo ' . string('Use :0Glog or :0Gclog for old behavior of targeting current file') . '|echohl NONE' . after
endif
- return s:QuickfixStream(listnr, 'log', title, s:UserCommandList(dir) + cmd, !a:bang, s:function('s:LogParse'), state, dir) . after
+ return s:QuickfixStream(listnr, 'log', title, s:UserCommandList(dir) + cmd, !a:bang, a:mods, s:function('s:LogParse'), state, dir) . after
endfunction
" Section: :Gedit, :Gpedit, :Gsplit, :Gvsplit, :Gtabedit, :Gread