Patch 9.0.0066

3 views
Skip to first unread message

Bram Moolenaar

unread,
Jul 25, 2022, 7:28:48 AM7/25/22
to vim...@googlegroups.com

Patch 9.0.0066
Problem: Switching window uneccarily when getting buffer options.
Solution: Do not switch window when getting buffer options. (closes #10767)
Files: src/evalvars.c


*** ../vim-9.0.0065/src/evalvars.c 2022-06-29 12:54:48.064572066 +0100
--- src/evalvars.c 2022-07-25 12:24:36.948648256 +0100
***************
*** 4098,4103 ****
--- 4098,4104 ----
int done = FALSE;
switchwin_T switchwin;
int need_switch_win;
+ int do_change_curbuf = buf != NULL && htname == 'b';

++emsg_off;

***************
*** 4112,4118 ****
// autocommands get blocked.
// If we have a buffer reference avoid the switching, we're saving and
// restoring curbuf directly.
! need_switch_win = !(tp == curtab && win == curwin) || (buf != NULL);
if (!need_switch_win || switch_win(&switchwin, win, tp, TRUE) == OK)
{
// Handle options. There are no tab-local options.
--- 4113,4119 ----
// autocommands get blocked.
// If we have a buffer reference avoid the switching, we're saving and
// restoring curbuf directly.
! need_switch_win = !(tp == curtab && win == curwin) && !do_change_curbuf;
if (!need_switch_win || switch_win(&switchwin, win, tp, TRUE) == OK)
{
// Handle options. There are no tab-local options.
***************
*** 4121,4132 ****
buf_T *save_curbuf = curbuf;

// Change curbuf so the option is read from the correct buffer.
! if (buf != NULL && htname == 'b')
curbuf = buf;

if (varname[1] == NUL)
{
! // get all window-local options in a dict
dict_T *opts = get_winbuf_options(htname == 'b');

if (opts != NULL)
--- 4122,4133 ----
buf_T *save_curbuf = curbuf;

// Change curbuf so the option is read from the correct buffer.
! if (do_change_curbuf)
curbuf = buf;

if (varname[1] == NUL)
{
! // get all window-local or buffer-local options in a dict
dict_T *opts = get_winbuf_options(htname == 'b');

if (opts != NULL)
*** ../vim-9.0.0065/src/version.c 2022-07-24 20:47:56.222680114 +0100
--- src/version.c 2022-07-25 12:25:49.500588559 +0100
***************
*** 737,738 ****
--- 737,740 ----
{ /* Add new patch number below this line */
+ /**/
+ 66,
/**/

--
Two percent of zero is almost nothing.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages