mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-12 13:23:52 -05:00
Fix focus anomaly when closing a split
This is seemingly the cause of an incompatibility with the DirDiff plugin.
This commit is contained in:
@@ -1013,8 +1013,8 @@ call s:command("-bar -nargs=? -complete=customlist,s:EditComplete Gsdiff :execut
|
|||||||
|
|
||||||
augroup fugitive_diff
|
augroup fugitive_diff
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd BufWinLeave * if s:diff_window_count() == 2 && &diff && getbufvar(+expand('<abuf>'), 'git_dir') !=# '' | execute 'windo call s:diff_off()' | endif
|
autocmd BufWinLeave * if s:diff_window_count() == 2 && &diff && getbufvar(+expand('<abuf>'), 'git_dir') !=# '' | call s:diff_off_all() | endif
|
||||||
autocmd BufWinEnter * if s:diff_window_count() == 1 && &diff && getbufvar(+expand('<abuf>'), 'git_dir') !=# '' | call s:diff_off() | endif
|
autocmd BufWinEnter * if s:diff_window_count() == 1 && &diff && getbufvar(+expand('<abuf>'), 'git_dir') !=# '' | diffoff | endif
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
function! s:diff_window_count()
|
function! s:diff_window_count()
|
||||||
@@ -1025,10 +1025,20 @@ function! s:diff_window_count()
|
|||||||
return c
|
return c
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:diff_off()
|
function! s:diff_off_all()
|
||||||
if &l:diff
|
for nr in range(1,winnr('$'))
|
||||||
diffoff
|
if getwinvar(nr,'&diff')
|
||||||
|
if winnr != winnr()
|
||||||
|
execute winnr.'wincmd w'
|
||||||
|
let restorewinnr = 1
|
||||||
endif
|
endif
|
||||||
|
execute nr.'wincmd w'
|
||||||
|
diffoff
|
||||||
|
if exists('restorewinnr')
|
||||||
|
wincmd p
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:buffer_compare_age(commit) dict abort
|
function! s:buffer_compare_age(commit) dict abort
|
||||||
|
|||||||
Reference in New Issue
Block a user