Improve keepjumps situation

This commit is contained in:
Tim Pope 2014-03-19 23:36:20 -04:00
parent b27937d5e4
commit 70ec927890

View File

@ -2227,7 +2227,7 @@ function! s:BufReadObject()
endif
let pos = getpos('.')
silent %delete
silent keepjumps %delete_
setlocal endofline
try
@ -2251,22 +2251,23 @@ function! s:BufReadObject()
call s:ReplaceCmd(s:repo().git_command('cat-file',b:fugitive_type,hash))
else
call s:ReplaceCmd(s:repo().git_command('show','--no-color','--pretty=format:tree %T%nparent %P%nauthor %an <%ae> %ad%ncommitter %cn <%ce> %cd%nencoding %e%n%n%s%n%n%b',hash))
call search('^parent ')
keepjumps call search('^parent ')
if getline('.') ==# 'parent '
silent delete_
silent keepjumps delete_
else
silent s/\%(^parent\)\@<! /\rparent /ge
silent keepjumps s/\%(^parent\)\@<! /\rparent /ge
endif
if search('^encoding \%(<unknown>\)\=$','W',line('.')+3)
silent delete_
keepjumps let lnum = search('^encoding \%(<unknown>\)\=$','W',line('.')+3)
if lnum
silent keepjumps delete_
end
1
keepjumps 1
endif
elseif b:fugitive_type ==# 'blob'
call s:ReplaceCmd(s:repo().git_command('cat-file',b:fugitive_type,hash))
endif
finally
call setpos('.',pos)
keepjumps call setpos('.',pos)
setlocal ro noma nomod noswapfile
if &bufhidden ==# ''
setlocal bufhidden=delete