From b6545ad389c32b795d2ad4ae4c45f87e92eb0caf Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Fri, 10 Sep 2021 02:39:54 -0400 Subject: [PATCH] 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 --- autoload/fugitive.vim | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 20ea1e8..cf708b5 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -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()