Fix :Gdiffsplit with diffopt+=vertical

Only remove "vertical" from `&diffopt` after calling
`s:diff_modifier()`.

Regressed in c972b2a.
References https://github.com/tpope/vim-fugitive/pull/805#issuecomment-522057790.
This commit is contained in:
Daniel Hahler 2019-08-16 18:02:28 +02:00 committed by Tim Pope
parent d6f7eaf16c
commit cb613ca05d

View File

@ -4416,10 +4416,6 @@ function! s:Diff(autodir, keepfocus, mods, ...) abort
endif endif
endif endif
try try
if &diffopt =~# 'vertical'
let diffopt = &diffopt
set diffopt-=vertical
endif
if exists('parents') && len(parents) > 1 if exists('parents') && len(parents) > 1
let mods = (a:autodir ? s:diff_modifier(len(parents) + 1) : '') . s:Mods(mods, 'leftabove') let mods = (a:autodir ? s:diff_modifier(len(parents) + 1) : '') . s:Mods(mods, 'leftabove')
let nr = bufnr('') let nr = bufnr('')
@ -4482,6 +4478,10 @@ function! s:Diff(autodir, keepfocus, mods, ...) abort
let mods = s:Mods(mods, 'leftabove') let mods = s:Mods(mods, 'leftabove')
endif endif
let mods = (a:autodir ? s:diff_modifier(2) : '') . mods let mods = (a:autodir ? s:diff_modifier(2) : '') . mods
if &diffopt =~# 'vertical'
let diffopt = &diffopt
set diffopt-=vertical
endif
execute mods 'diffsplit' s:fnameescape(spec) execute mods 'diffsplit' s:fnameescape(spec)
let &l:readonly = &l:readonly let &l:readonly = &l:readonly
redraw redraw