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 -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20220725112838.158FC1C066C%40moolenaar.net.