diff src/eval.c @ 10000:233289599874 v7.4.2273

commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Aug 27 21:25:44 2016 +0200 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().
author Christian Brabandt <cb@256bit.org>
date Sat, 27 Aug 2016 21:30:06 +0200
parents b329e3ca0dcb
children 4aead6a9b7a9
line wrap: on
line diff
--- 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 (get_option_tv(&varname, rettv, 1) == OK)
+	    if (*varname == '&')
+	    {
+		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