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') call s:QuickfixSet(a:nr, buffer, 'a')
exe s:DoAutocmd('QuickFixCmdPost ' . event) exe s:DoAutocmd('QuickFixCmdPost ' . event)
if a:first && len(s:QuickfixGet(a:nr)) if a:first
return (a:nr < 0 ? 'cfirst' : 'lfirst') let list = s:QuickfixGet(a:nr)
else for index in range(len(list))
return 'exe' if list[index].valid
return (index+1) . (a:nr < 0 ? 'cfirst' : 'lfirst')
endif endif
endfor
endif
return 'exe'
endfunction endfunction
function! fugitive#Cwindow() abort function! fugitive#Cwindow() abort