1
0
forked from aniani/vim

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().
This commit is contained in:
Bram Moolenaar
2016-08-27 21:25:44 +02:00
parent 9f8187c335
commit 3056735ae8
5 changed files with 93 additions and 32 deletions

View File

@@ -8470,9 +8470,23 @@ getwinvar(
|| 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