vim-patch:9.1.1482: scrolling with 'splitkeep' and line() (#34670)

Problem:  Topline is preemptively updated by line() in WinResized
          autocmd with 'splitkeep' != "cursor".
Solution: Set `skip_update_topline` when 'splitkeep' != "cursor".
          (Luuk van Baal)

fe803c8c04
This commit is contained in:
luukvbaal
2025-06-27 11:16:23 +02:00
committed by GitHub
parent e518666f1d
commit 0b91e9f83b
3 changed files with 49 additions and 6 deletions

View File

@@ -4379,17 +4379,15 @@ static void f_line(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
if (wp != NULL && tp != NULL) {
switchwin_T switchwin;
if (switch_win_noblock(&switchwin, wp, tp, true) == OK) {
// in diff mode, prevent that the window scrolls
// and keep the topline
if (curwin->w_p_diff && switchwin.sw_curwin->w_p_diff) {
// With 'splitkeep' != cursor and in diff mode, prevent that the
// window scrolls and keep the topline.
if (*p_spk != 'c' || (curwin->w_p_diff && switchwin.sw_curwin->w_p_diff)) {
skip_update_topline = true;
}
check_cursor(curwin);
fp = var2fpos(&argvars[0], true, &fnum, false);
}
if (curwin->w_p_diff && switchwin.sw_curwin->w_p_diff) {
skip_update_topline = false;
}
skip_update_topline = false;
restore_win_noblock(&switchwin, true);
}
} else {