motiejus/dotfiles

Unnamed repository; edit this file 'description' to name the repository.
git clone https://git.jakstys.lt/motiejus/dotfiles.git
Log | Tree | Refs | README | LICENSE

commit 7bcfe539beee5fe8c542092732b6fd3786c6080e (tree)
parent 866ecfff4ed6ab0c92aadca462cf2b93d414e4f1
Author: Tim Pope <code@tpope.net>
Date:   Fri, 27 Nov 2020 09:40:22 -0500

Avoid window shenanigans if :diffoff restores options

Closes https://github.com/tpope/vim-fugitive/issues/1634

Diffstat:
Mautoload/fugitive.vim | 21+++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim @@ -4891,25 +4891,30 @@ function! s:diffthis() abort endfunction function! s:diffoff() abort - if exists('w:fugitive_diff_restore') + if exists('w:fugitive_diff_restore') && v:version < 704 execute w:fugitive_diff_restore - unlet w:fugitive_diff_restore - else - diffoff endif + unlet! w:fugitive_diff_restore + diffoff endfunction function! s:diffoff_all(dir) abort let curwin = winnr() for nr in range(1,winnr('$')) if getwinvar(nr, '&diff') && !empty(getwinvar(nr, 'fugitive_diff_restore')) - if nr != winnr() - execute nr.'wincmd w' + if v:version < 704 + if nr != winnr() + execute nr.'wincmd w' + endif + execute w:fugitive_diff_restore endif - call s:diffoff() + call setwinvar(nr, 'fugitive_diff_restore', '') endif endfor - execute curwin.'wincmd w' + if curwin != winnr() + execute curwin.'wincmd w' + endif + diffoff! endfunction function! s:CompareAge(mine, theirs) abort