Fix inconsistency when scrolling :Git! preview window

Scrolling with win_execute() works fine while the command is running,
but once the job has finished, it fails to update the viewport until the
window is focused.  I don't get it.  It's not like the window knows a
job is running.  The only obvious trigger I could find is that
'nobuflisted' is set once once the job completes, but even disabling
that behavior fails to rectify the problem.  Screw it, manual focus
bouncing for everyone.

References: https://github.com/tpope/vim-fugitive/issues/1832
This commit is contained in:
Tim Pope
2021-09-10 02:39:54 -04:00
parent be0abe0b21
commit b6545ad389

View File

@@ -3214,11 +3214,7 @@ function! s:RunReceive(state, tmp, type, job, data, ...) abort
call setbufline(a:state.capture_bufnr, line_count + 1, lines)
endif
call setbufvar(a:state.capture_bufnr, '&modifiable', 0)
if !getwinvar(bufwinid(a:state.capture_bufnr), '&previewwindow')
" no-op
elseif exists('*win_execute')
call win_execute(bufwinid(a:state.capture_bufnr), '$')
else
if getwinvar(bufwinid(a:state.capture_bufnr), '&previewwindow')
let winnr = bufwinnr(a:state.capture_bufnr)
if winnr > 0
let old_winnr = winnr()