]> granicus.if.org Git - vim/commitdiff
patch 7.4.1113 v7.4.1113
authorBram Moolenaar <Bram@vim.org>
Sun, 17 Jan 2016 13:59:01 +0000 (14:59 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 17 Jan 2016 13:59:01 +0000 (14:59 +0100)
Problem:    Using {ns} in variable name does not work. (lilydjwg)
Solution:   Fix recognizing colon.  Add a test.

src/eval.c
src/testdir/test_viml.vim
src/version.c

index c61b64dd600767965a2a61da7d79e5edb45c3714..fb2cbe79e50d4422b76f42742d186e4dcb0a5a0e 100644 (file)
@@ -20844,10 +20844,10 @@ find_name_end(arg, expr_start, expr_end, flags)
        else if (br_nest == 0 && mb_nest == 0 && *p == ':')
        {
            /* "s:" is start of "s:var", but "n:" is not and can be used in
-            * slice "[n:]".  Also "xx:" is not a namespace. */
+            * slice "[n:]".  Also "xx:" is not a namespace. But {ns}: is. */
            len = (int)(p - arg);
            if ((len == 1 && vim_strchr(NAMESPACE_CHAR, *arg) == NULL)
-                   || len > 1)
+                   || (len > 1 && p[-1] != '}'))
                break;
        }
 
index 5d65953a9e79079282a98ae79e91f36cdd9ba8bc..07286fb0243c9ab60cb642579cce894fddbdfce9 100644 (file)
@@ -1,5 +1,5 @@
 " Test various aspects of the Vim language.
-" This was formerly in test49.
+" Most of this was formerly in test49.
 
 "-------------------------------------------------------------------------------
 " Test environment                                                         {{{1
@@ -906,6 +906,20 @@ func Test_if_bar_fail()
     call assert_equal('acdfh-acfh', g:test15_result)
 endfunc
 
+"-------------------------------------------------------------------------------
+" Test 90:  Recognizing {} in variable name.                       {{{1
+"-------------------------------------------------------------------------------
+
+func Test_curlies()
+    let s:var = 66
+    let ns = 's'
+    call assert_equal(66, {ns}:var)
+
+    let g:a = {}
+    let g:b = 't'
+    let g:a[g:b] = 77
+    call assert_equal(77, g:a['t'])
+endfunc
 
 "-------------------------------------------------------------------------------
 " Modelines                                                                {{{1
index 4cce40b91181d68fda8f3a0244a1ebbd89c20a4d..8d9fda815340a85fa1aacb1e4fa644c7261b18f2 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1113,
 /**/
     1112,
 /**/