diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-08-27 21:25:44 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-08-27 21:25:44 +0200 |
commit | 3056735ae8a366aa7fcb51872520895251858637 (patch) | |
tree | 329de3dbeea7c06972c0ea41929b636f9ef47540 /src/eval.c | |
parent | 9f8187c335b4fb07be9095dfdd0fc52670ba3c3f (diff) | |
download | vim-git-3056735ae8a366aa7fcb51872520895251858637.tar.gz |
patch 7.4.2273v7.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().
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/eval.c b/src/eval.c index 350173a23..a8835b10b 100644 --- a/src/eval.c +++ b/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 |