comparison src/evalvars.c @ 34146:23bb675796f0 v9.1.0034

patch 9.1.0034: Window scrolls unexpectedly when 'scrollbind' is set Commit: https://github.com/vim/vim/commit/ac4cffc6d9d307778d8a2945adab70244470bbb8 Author: Christian Brabandt <cb@256bit.org> Date: Tue Jan 16 17:22:38 2024 +0100 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>
author Christian Brabandt <cb@256bit.org>
date Tue, 16 Jan 2024 17:30:10 +0100
parents 1629cc65d78d
children 6df143135376
comparison
equal deleted inserted replaced
34145:358d769bbdd4 34146:23bb675796f0
4922 return; 4922 return;
4923 4923
4924 if (*varname == '&') 4924 if (*varname == '&')
4925 { 4925 {
4926 aco_save_T aco; 4926 aco_save_T aco;
4927 // safe the current window position, it could
4928 // change because of 'scrollbind' window-local
4929 // options
4930 linenr_T old_topline = curwin->w_topline;
4927 4931
4928 // Set curbuf to be our buf, temporarily. 4932 // Set curbuf to be our buf, temporarily.
4929 aucmd_prepbuf(&aco, buf); 4933 aucmd_prepbuf(&aco, buf);
4930 if (curbuf == buf) 4934 if (curbuf == buf)
4931 { 4935 {
4933 set_option_from_tv(varname + 1, varp); 4937 set_option_from_tv(varname + 1, varp);
4934 4938
4935 // reset notion of buffer 4939 // reset notion of buffer
4936 aucmd_restbuf(&aco); 4940 aucmd_restbuf(&aco);
4937 } 4941 }
4942 curwin->w_topline = old_topline;
4938 } 4943 }
4939 else 4944 else
4940 { 4945 {
4941 bufvarname = alloc(STRLEN(varname) + 3); 4946 bufvarname = alloc(STRLEN(varname) + 3);
4942 if (bufvarname != NULL) 4947 if (bufvarname != NULL)