Fix jump to patched line in :Gstatus

This commit is contained in:
Tim Pope 2019-07-05 00:55:57 -04:00
parent a0e8f59b68
commit ed5ac8dc5d

View File

@ -4429,14 +4429,14 @@ function! s:StatusCfile(...) abort
let line = getline('.') let line = getline('.')
if len(info.sigil) && len(info.section) && len(info.paths) if len(info.sigil) && len(info.section) && len(info.paths)
if info.section ==# 'Unstaged' && info.sigil !=# '-' if info.section ==# 'Unstaged' && info.sigil !=# '-'
return [lead . info.paths[0], info.offset, 'normal!zv'] return [lead . info.relative[0], info.offset, 'normal!zv']
elseif info.section ==# 'Staged' && info.sigil ==# '-' elseif info.section ==# 'Staged' && info.sigil ==# '-'
return ['@:' . info.paths[0], info.offset, 'normal!zv'] return ['@:' . info.relative[0], info.offset, 'normal!zv']
else else
return [':0:' . info.paths[0], info.offset, 'normal!zv'] return [':0:' . info.relative[0], info.offset, 'normal!zv']
endif endif
elseif len(info.paths) elseif len(info.paths)
return [lead . info.paths[0]] return [lead . info.relative[0]]
elseif len(info.commit) elseif len(info.commit)
return [info.commit] return [info.commit]
elseif line =~# '^\%(Head\|Merge\|Rebase\|Upstream\|Pull\|Push\): ' elseif line =~# '^\%(Head\|Merge\|Rebase\|Upstream\|Pull\|Push\): '