vim-patch:7.4.1113

Problem:    Using {ns} in variable name does not work. (lilydjwg)
Solution:   Fix recognizing colon.  Add a test.
This commit is contained in:
Grzegorz Milka
2016-04-17 12:32:23 +02:00
parent ba9bdb3e70
commit 02fa6b18d6
3 changed files with 20 additions and 4 deletions

View File

@@ -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 == ':') { } else if (br_nest == 0 && mb_nest == 0 && *p == ':') {
// "s:" is start of "s:var", but "n:" is not and can be used in // "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); len = (int)(p - arg);
if (len > 1 if ((len > 1 && p[-1] != '}')
|| (len == 1 && vim_strchr(namespace_char, *arg) == NULL)) { || (len == 1 && vim_strchr(namespace_char, *arg) == NULL)) {
break; break;
} }

View File

@@ -1,5 +1,5 @@
" Test various aspects of the Vim language. " Test various aspects of the Vim language.
" This was formerly in test49. " Most of this was formerly in test49.
"------------------------------------------------------------------------------- "-------------------------------------------------------------------------------
" Test environment {{{1 " Test environment {{{1
@@ -907,6 +907,22 @@ func Test_if_bar_fail()
endfunc 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 " Modelines {{{1
" vim: ts=8 sw=4 tw=80 fdm=marker " vim: ts=8 sw=4 tw=80 fdm=marker

View File

@@ -251,7 +251,7 @@ static int included_patches[] = {
// 1116, // 1116,
// 1115 NA // 1115 NA
// 1114, // 1114,
// 1113, 1113,
1112, 1112,
// 1111, // 1111,
// 1110, // 1110,