To: vim_dev@googlegroups.com Subject: Patch 7.4.1113 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1113 (after 7.4.1105) Problem: Using {ns} in variable name does not work. (lilydjwg) Solution: Fix recognizing colon. Add a test. Files: src/eval.c, src/testdir/test_viml.vim *** ../vim-7.4.1112/src/eval.c 2016-01-16 21:26:30.501956438 +0100 --- src/eval.c 2016-01-17 14:47:50.102649972 +0100 *************** *** 20844,20853 **** 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. */ len = (int)(p - arg); if ((len == 1 && vim_strchr(NAMESPACE_CHAR, *arg) == NULL) ! || len > 1) break; } --- 20844,20853 ---- 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. But {ns}: is. */ len = (int)(p - arg); if ((len == 1 && vim_strchr(NAMESPACE_CHAR, *arg) == NULL) ! || (len > 1 && p[-1] != '}')) break; } *** ../vim-7.4.1112/src/testdir/test_viml.vim 2016-01-02 19:50:00.196639435 +0100 --- src/testdir/test_viml.vim 2016-01-17 14:50:20.373044055 +0100 *************** *** 1,5 **** " Test various aspects of the Vim language. ! " This was formerly in test49. "------------------------------------------------------------------------------- " Test environment {{{1 --- 1,5 ---- " Test various aspects of the Vim language. ! " Most of this was formerly in test49. "------------------------------------------------------------------------------- " Test environment {{{1 *************** *** 906,911 **** --- 906,925 ---- 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 *** ../vim-7.4.1112/src/version.c 2016-01-16 22:49:30.707420082 +0100 --- src/version.c 2016-01-17 14:58:11.012013339 +0100 *************** *** 743,744 **** --- 743,746 ---- { /* Add new patch number below this line */ + /**/ + 1113, /**/ -- "You're fired." (1980) "You're laid off." (1985) "You're downsized." (1990) "You're rightsized." (1992) (Scott Adams - The Dilbert principle) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///