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:
18
src/eval.c
18
src/eval.c
@@ -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
|
||||
|
Reference in New Issue
Block a user