diff options
author | Grzegorz Milka <grzegorzmilka@gmail.com> | 2016-04-17 12:32:23 +0200 |
---|---|---|
committer | Grzegorz Milka <grzegorzmilka@gmail.com> | 2016-04-19 19:54:52 +0200 |
commit | 02fa6b18d6da55f0738d1cd97d462032c9135cd6 (patch) | |
tree | 65de5c3876b9096463ce8ab806d33b37256e4f54 /src | |
parent | ba9bdb3e70722942049fc17c52ef3d9eea866256 (diff) | |
download | rneovim-02fa6b18d6da55f0738d1cd97d462032c9135cd6.tar.gz rneovim-02fa6b18d6da55f0738d1cd97d462032c9135cd6.tar.bz2 rneovim-02fa6b18d6da55f0738d1cd97d462032c9135cd6.zip |
vim-patch:7.4.1113
Problem: Using {ns} in variable name does not work. (lilydjwg)
Solution: Fix recognizing colon. Add a test.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/eval.c | 4 | ||||
-rw-r--r-- | src/nvim/testdir/test_viml.vim | 18 | ||||
-rw-r--r-- | src/nvim/version.c | 2 |
3 files changed, 20 insertions, 4 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 9d370632a1..d3145bb45a 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -16986,9 +16986,9 @@ static char_u *find_name_end(char_u *arg, char_u **expr_start, } } 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 + if ((len > 1 && p[-1] != '}') || (len == 1 && vim_strchr(namespace_char, *arg) == NULL)) { break; } diff --git a/src/nvim/testdir/test_viml.vim b/src/nvim/testdir/test_viml.vim index 5d65953a9e..9f0618bd45 100644 --- a/src/nvim/testdir/test_viml.vim +++ b/src/nvim/testdir/test_viml.vim @@ -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 @@ -908,6 +908,22 @@ endfunc "------------------------------------------------------------------------------- +" Test 16: 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: ts=8 sw=4 tw=80 fdm=marker " vim: fdt=substitute(substitute(foldtext(),\ '\\%(^+--\\)\\@<=\\(\\s*\\)\\(.\\{-}\\)\:\ \\%(\"\ \\)\\=\\(Test\ \\d*\\)\:\\s*',\ '\\3\ (\\2)\:\ \\1',\ \"\"),\ '\\(Test\\s*\\)\\(\\d\\)\\D\\@=',\ '\\1\ \\2',\ "") diff --git a/src/nvim/version.c b/src/nvim/version.c index e0d5e984cd..7b7d711cec 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -251,7 +251,7 @@ static int included_patches[] = { // 1116, // 1115 NA // 1114, - // 1113, + 1113, 1112, // 1111, // 1110, |