mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-12 21:33:53 -05:00
Avoid window shenanigans if :diffoff restores options
Closes https://github.com/tpope/vim-fugitive/issues/1634
This commit is contained in:
@@ -4891,25 +4891,30 @@ function! s:diffthis() abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:diffoff() abort
|
function! s:diffoff() abort
|
||||||
if exists('w:fugitive_diff_restore')
|
if exists('w:fugitive_diff_restore') && v:version < 704
|
||||||
execute w:fugitive_diff_restore
|
execute w:fugitive_diff_restore
|
||||||
unlet w:fugitive_diff_restore
|
|
||||||
else
|
|
||||||
diffoff
|
|
||||||
endif
|
endif
|
||||||
|
unlet! w:fugitive_diff_restore
|
||||||
|
diffoff
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:diffoff_all(dir) abort
|
function! s:diffoff_all(dir) abort
|
||||||
let curwin = winnr()
|
let curwin = winnr()
|
||||||
for nr in range(1,winnr('$'))
|
for nr in range(1,winnr('$'))
|
||||||
if getwinvar(nr, '&diff') && !empty(getwinvar(nr, 'fugitive_diff_restore'))
|
if getwinvar(nr, '&diff') && !empty(getwinvar(nr, 'fugitive_diff_restore'))
|
||||||
|
if v:version < 704
|
||||||
if nr != winnr()
|
if nr != winnr()
|
||||||
execute nr.'wincmd w'
|
execute nr.'wincmd w'
|
||||||
endif
|
endif
|
||||||
call s:diffoff()
|
execute w:fugitive_diff_restore
|
||||||
|
endif
|
||||||
|
call setwinvar(nr, 'fugitive_diff_restore', '')
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
if curwin != winnr()
|
||||||
execute curwin.'wincmd w'
|
execute curwin.'wincmd w'
|
||||||
|
endif
|
||||||
|
diffoff!
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:CompareAge(mine, theirs) abort
|
function! s:CompareAge(mine, theirs) abort
|
||||||
|
|||||||
Reference in New Issue
Block a user