commit 16bfd4fa92020c1684342aefa6a5665a16c4aebd (tree)
parent 8038ee60a9ecbba8f762b43622695e9e5bff21bd
Author: Tim Pope <code@tpope.net>
Date: Tue, 13 Aug 2019 17:20:00 -0400
Fix offset jumping to patch on :Gblame --reverse
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim
@@ -4837,6 +4837,7 @@ function! s:BlameCommit(cmd, ...) abort
if commit =~# '^0*$'
return 'echoerr ' . string('fugitive: no commit')
endif
+ let sigil = has_key(a:0 ? a:2 : s:TempState(), 'blame_reverse_end') ? '-' : '+'
let cmd = s:Open((s:BlameBufnr() < 0 ? '' : &splitbelow ? "botright " : "topleft ") . a:cmd, 0, '', commit, [commit])
if cmd =~# '^echoerr'
return cmd
@@ -4849,8 +4850,9 @@ function! s:BlameCommit(cmd, ...) abort
call search('^+++')
let head = line('.')
while search('^@@ \|^diff ') && getline('.') =~# '^@@ '
- let top = +matchstr(getline('.'),' +\zs\d\+')
- let len = +matchstr(getline('.'),' +\d\+,\zs\d\+')
+ let top = +matchstr(getline('.'),' ' . sigil .'\zs\d\+')
+ let len = +matchstr(getline('.'),' ' . sigil . '\d\+,\zs\d\+')
+ echo [sigil, top, len]
if lnum >= top && lnum <= top + len
let offset = lnum - top
if &scrolloff
@@ -4862,7 +4864,7 @@ function! s:BlameCommit(cmd, ...) abort
endif
while offset > 0 && line('.') < line('$')
+
- if getline('.') =~# '^[ +]'
+ if getline('.') =~# '^[ ' . sigil . ']'
let offset -= 1
endif
endwhile