patch 9.1.1482: scrolling with 'splitkeep' and line()
Problem: Topline is preemptively updated by line() in WinResized
autocmd with 'splitkeep' != "cursor".
Solution: Set `skip_update_topline` when 'splitkeep' != "cursor".
(Luuk van Baal)
related: neovim/neovim#34666
closes: #17613
Signed-off-by: Luuk van Baal <luukvbaal@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 76955a7..2e864f7 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -8833,19 +8833,18 @@
{
if (switch_win_noblock(&switchwin, wp, tp, TRUE) == OK)
{
+ // With 'splitkeep' != cursor and in diff mode, prevent that the
+ // window scrolls and keep the topline.
+ if (*p_spk != 'c'
#ifdef FEAT_DIFF
- // in diff mode, prevent that the window scrolls
- // and keep the topline
- if (curwin->w_p_diff && switchwin.sw_curwin->w_p_diff)
- skip_update_topline = TRUE;
+ || (curwin->w_p_diff && switchwin.sw_curwin->w_p_diff)
#endif
+ )
+ skip_update_topline = TRUE;
check_cursor();
fp = var2fpos(&argvars[0], TRUE, &fnum, FALSE);
}
-#ifdef FEAT_DIFF
- if (curwin->w_p_diff && switchwin.sw_curwin->w_p_diff)
- skip_update_topline = FALSE;
-#endif
+ skip_update_topline = FALSE;
restore_win_noblock(&switchwin, TRUE);
}
}