Never jump to invalid entry after quickfix command

In particular, if the first :Ggrep result is a binary file, skip over
it.  I'm also leaning strongly towards not filling in the filename field
at all for binary files, but I'll address that separately.
This commit is contained in:
Tim Pope
2023-08-27 15:31:16 -04:00
parent b3b838d690
commit 572c851012

View File

@@ -1576,11 +1576,15 @@ function! s:QuickfixStream(nr, event, title, cmd, first, mods, callback, ...) ab
call s:QuickfixSet(a:nr, buffer, 'a')
exe s:DoAutocmd('QuickFixCmdPost ' . event)
if a:first && len(s:QuickfixGet(a:nr))
return (a:nr < 0 ? 'cfirst' : 'lfirst')
else
return 'exe'
if a:first
let list = s:QuickfixGet(a:nr)
for index in range(len(list))
if list[index].valid
return (index+1) . (a:nr < 0 ? 'cfirst' : 'lfirst')
endif
endfor
endif
return 'exe'
endfunction
function! fugitive#Cwindow() abort