Skip to content

Commit 8d4e8d4

Browse files
committed
Set winfixbuf on status windows
Resolves: #2272
1 parent 549e283 commit 8d4e8d4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

autoload/fugitive.vim

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4162,7 +4162,9 @@ function! s:StatusCommand(line1, line2, range, count, bang, mods, reg, arg, args
41624162
try
41634163
let mods = s:Mods(a:mods, 'Edge')
41644164
let file = fugitive#Find(':', dir)
4165-
let arg = ' +setl\ foldmarker=<<<<<<<<,>>>>>>>>\|let\ w:fugitive_status=FugitiveGitDir() ' .
4165+
let arg = ' +setl\ foldmarker=<<<<<<<<,>>>>>>>>' .
4166+
\ (exists('&winfixbuf') ? '\ winfixbuf' : '') .
4167+
\ '\|let\ w:fugitive_status=FugitiveGitDir() ' .
41664168
\ s:fnameescape(file)
41674169
for tabnr in [tabpagenr()] + (mods =~# '\<tab\>' ? range(1, tabpagenr('$')) : [])
41684170
let bufs = tabpagebuflist(tabnr)
@@ -4176,6 +4178,9 @@ function! s:StatusCommand(line1, line2, range, count, bang, mods, reg, arg, args
41764178
exe winnr . 'wincmd w'
41774179
endif
41784180
let w:fugitive_status = dir
4181+
if exists('&winfixbuf')
4182+
setlocal winfixbuf
4183+
endif
41794184
1
41804185
return ''
41814186
endif
@@ -6203,7 +6208,7 @@ function! fugitive#DiffClose() abort
62036208
endfunction
62046209

62056210
function! s:BlurStatus() abort
6206-
if (&previewwindow || exists('w:fugitive_status')) && get(b:,'fugitive_type', '') ==# 'index'
6211+
if (&previewwindow || getwinvar(winnr(), '&winfixbuf') is# 1 || exists('w:fugitive_status')) && get(b:, 'fugitive_type', '') ==# 'index'
62076212
let winnrs = filter([winnr('#')] + range(1, winnr('$')), 's:UsableWin(v:val)')
62086213
if len(winnrs)
62096214
exe winnrs[0].'wincmd w'

0 commit comments

Comments
 (0)