1
0
forked from aniani/vim

patch 9.1.0034: Window scrolls unexpectedly when 'scrollbind' is set

Problem:  Window may unexpectedly scroll when 'scrollbind' is set
          and setting a buffer-local option using setbufvar()
          (Boris Staletic)
Solution: Save and restore the windows topline before opening the
          popup window.

fixes: #13863
closes: #13869

Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Christian Brabandt
2024-01-16 17:22:38 +01:00
parent 96958366ad
commit ac4cffc6d9
3 changed files with 25 additions and 0 deletions

View File

@@ -4924,6 +4924,10 @@ f_setbufvar(typval_T *argvars, typval_T *rettv UNUSED)
if (*varname == '&')
{
aco_save_T aco;
// safe the current window position, it could
// change because of 'scrollbind' window-local
// options
linenr_T old_topline = curwin->w_topline;
// Set curbuf to be our buf, temporarily.
aucmd_prepbuf(&aco, buf);
@@ -4935,6 +4939,7 @@ f_setbufvar(typval_T *argvars, typval_T *rettv UNUSED)
// reset notion of buffer
aucmd_restbuf(&aco);
}
curwin->w_topline = old_topline;
}
else
{