• R/O
  • SSH

vim: Commit

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

Révision8f1e16995118a8b68bc63c790072e2e86ff28257 (tree)
l'heure2022-07-25 20:30:05
AuteurBram Moolenaar <Bram@vim....>
CommiterBram Moolenaar

Message de Log

patch 9.0.0066: switching window uneccarily when getting buffer options

Commit: https://github.com/vim/vim/commit/cd6ad6439da2ee2d1a8a6934c9d69e9c2664ba55
Author: zeertzjq <zeertzjq@outlook.com>
Date: Mon Jul 25 12:28:09 2022 +0100

patch 9.0.0066: switching window uneccarily when getting buffer options
Problem: Switching window uneccarily when getting buffer options.
Solution: Do not switch window when getting buffer options. (closes https://github.com/vim/vim/issues/10767)

Change Summary

Modification

diff -r eb01d8edb0ae -r 8f1e16995118 src/evalvars.c
--- a/src/evalvars.c Sun Jul 24 22:00:04 2022 +0200
+++ b/src/evalvars.c Mon Jul 25 13:30:05 2022 +0200
@@ -4098,6 +4098,7 @@
40984098 int done = FALSE;
40994099 switchwin_T switchwin;
41004100 int need_switch_win;
4101+ int do_change_curbuf = buf != NULL && htname == 'b';
41014102
41024103 ++emsg_off;
41034104
@@ -4112,7 +4113,7 @@
41124113 // autocommands get blocked.
41134114 // If we have a buffer reference avoid the switching, we're saving and
41144115 // restoring curbuf directly.
4115- need_switch_win = !(tp == curtab && win == curwin) || (buf != NULL);
4116+ need_switch_win = !(tp == curtab && win == curwin) && !do_change_curbuf;
41164117 if (!need_switch_win || switch_win(&switchwin, win, tp, TRUE) == OK)
41174118 {
41184119 // Handle options. There are no tab-local options.
@@ -4121,12 +4122,12 @@
41214122 buf_T *save_curbuf = curbuf;
41224123
41234124 // Change curbuf so the option is read from the correct buffer.
4124- if (buf != NULL && htname == 'b')
4125+ if (do_change_curbuf)
41254126 curbuf = buf;
41264127
41274128 if (varname[1] == NUL)
41284129 {
4129- // get all window-local options in a dict
4130+ // get all window-local or buffer-local options in a dict
41304131 dict_T *opts = get_winbuf_options(htname == 'b');
41314132
41324133 if (opts != NULL)
diff -r eb01d8edb0ae -r 8f1e16995118 src/version.c
--- a/src/version.c Sun Jul 24 22:00:04 2022 +0200
+++ b/src/version.c Mon Jul 25 13:30:05 2022 +0200
@@ -736,6 +736,8 @@
736736 static int included_patches[] =
737737 { /* Add new patch number below this line */
738738 /**/
739+ 66,
740+/**/
739741 65,
740742 /**/
741743 64,
Afficher sur ancien navigateur de dépôt.