patch 7.4.2273
Problem: getwininfo() and getbufinfo() are inefficient.
Solution: Do not make a copy of all window/buffer-local options. Make it
possible to get them with gettabwinvar() or getbufvar().
diff --git a/src/eval.c b/src/eval.c
index 350173a..a8835b1 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -8470,9 +8470,23 @@
|| switch_win(&oldcurwin, &oldtabpage, win, tp, TRUE) == OK)
#endif
{
- if (*varname == '&') /* window-local-option */
+ if (*varname == '&')
{
- if (get_option_tv(&varname, rettv, 1) == OK)
+ if (varname[1] == NUL)
+ {
+ /* get all window-local options in a dict */
+ dict_T *opts = get_winbuf_options(FALSE);
+
+ if (opts != NULL)
+ {
+ rettv->v_type = VAR_DICT;
+ rettv->vval.v_dict = opts;
+ ++opts->dv_refcount;
+ done = TRUE;
+ }
+ }
+ else if (get_option_tv(&varname, rettv, 1) == OK)
+ /* window-local-option */
done = TRUE;
}
else