diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-10-30 09:05:11 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-30 09:05:11 +0800 |
commit | 05d9e6a9e850ee797a4a018e72156dd62831a4b6 (patch) | |
tree | 913916e0f463e62040ff3b87936f6a5843e79b42 /src/nvim/eval/funcs.c | |
parent | ff93cccbc1ce4bb217d503e2ac5f81f9023d4d43 (diff) | |
download | rneovim-05d9e6a9e850ee797a4a018e72156dd62831a4b6.tar.gz rneovim-05d9e6a9e850ee797a4a018e72156dd62831a4b6.tar.bz2 rneovim-05d9e6a9e850ee797a4a018e72156dd62831a4b6.zip |
vim-patch:9.1.0822: topline might be changed in diff mode unexpectedly (#30988)
Problem: topline might be changed in diff mode unexpectedly
(Jaehwang Jung)
Solution: do not re-calculate topline, when using line() func
in diff mode.
fixes: vim/vim#15812
closes: vim/vim#15950
https://github.com/vim/vim/commit/05a40e07c2f0e41b708c4c75a6aa7d0e7f6201a3
Co-authored-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/nvim/eval/funcs.c')
-rw-r--r-- | src/nvim/eval/funcs.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index e8b9288717..8f676d7906 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -4351,9 +4351,17 @@ 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) { + 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; + } restore_win_noblock(&switchwin, true); } } else { |