Don't match :0: as line number in :Ggrep

This is explicitly to help with false positives in surrounding context
while grepping this very file, as :0: is used in numerous places to
reference blobs in the index.  We also use :1: and company in a few
places, but a robust fix is much harder.
This commit is contained in:
Tim Pope
2021-08-16 18:25:42 -04:00
parent f3e92c7721
commit b5e7e1ba24

View File

@@ -5031,7 +5031,7 @@ endfunction
function! s:GrepParseLine(prefix, name_only, dir, line) abort
let entry = {'valid': 1}
let match = matchlist(a:line, '^\(.\{-\}\):\(\d\+\):\(\d\+:\)\=\(.*\)$')
let match = matchlist(a:line, '^\(.\{-\}\):\([1-9]\d*\):\([1-9]\d*:\)\=\(.*\)$')
if len(match)
let entry.module = match[1]
let entry.lnum = +match[2]