Skip to content

Commit 4119cf8

Browse files
committed
patch 7.4.1113
Problem: Using {ns} in variable name does not work. (lilydjwg) Solution: Fix recognizing colon. Add a test.
1 parent 2db5c3b commit 4119cf8

3 files changed

Lines changed: 19 additions & 3 deletions

File tree

src/eval.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20844,10 +20844,10 @@ find_name_end(arg, expr_start, expr_end, flags)
2084420844
else if (br_nest == 0 && mb_nest == 0 && *p == ':')
2084520845
{
2084620846
/* "s:" is start of "s:var", but "n:" is not and can be used in
20847-
* slice "[n:]". Also "xx:" is not a namespace. */
20847+
* slice "[n:]". Also "xx:" is not a namespace. But {ns}: is. */
2084820848
len = (int)(p - arg);
2084920849
if ((len == 1 && vim_strchr(NAMESPACE_CHAR, *arg) == NULL)
20850-
|| len > 1)
20850+
|| (len > 1 && p[-1] != '}'))
2085120851
break;
2085220852
}
2085320853

src/testdir/test_viml.vim

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
" Test various aspects of the Vim language.
2-
" This was formerly in test49.
2+
" Most of this was formerly in test49.
33

44
"-------------------------------------------------------------------------------
55
" Test environment {{{1
@@ -906,6 +906,20 @@ func Test_if_bar_fail()
906906
call assert_equal('acdfh-acfh', g:test15_result)
907907
endfunc
908908

909+
"-------------------------------------------------------------------------------
910+
" Test 90: Recognizing {} in variable name. {{{1
911+
"-------------------------------------------------------------------------------
912+
913+
func Test_curlies()
914+
let s:var = 66
915+
let ns = 's'
916+
call assert_equal(66, {ns}:var)
917+
918+
let g:a = {}
919+
let g:b = 't'
920+
let g:a[g:b] = 77
921+
call assert_equal(77, g:a['t'])
922+
endfunc
909923

910924
"-------------------------------------------------------------------------------
911925
" Modelines {{{1

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,8 @@ static char *(features[]) =
741741

742742
static int included_patches[] =
743743
{ /* Add new patch number below this line */
744+
/**/
745+
1113,
744746
/**/
745747
1112,
746748
/**/

0 commit comments

Comments
 (0)