vim-patch:7.4.1105

Problem:    When using slices there is a mixup of variable name and namespace.
Solution:   Recognize variables that can't be a namespace. (Hirohito Higashi)

9bbf63dbf8
This commit is contained in:
Jurica Bradaric
2016-02-27 18:11:39 +01:00
parent 3e0fab6b7c
commit 11cf3680e4
3 changed files with 72 additions and 32 deletions

View File

@@ -693,4 +693,22 @@ describe('eval', function()
start:
6]])
end)
it('substring and variable name', function()
execute("let str = 'abcdef'")
execute('let n = 3')
eq('def', eval('str[n:]'))
eq('abcd', eval('str[:n]'))
eq('d', eval('str[n:n]'))
execute('unlet n')
execute('let nn = 3')
eq('def', eval('str[nn:]'))
eq('abcd', eval('str[:nn]'))
eq('d', eval('str[nn:nn]'))
execute('unlet nn')
execute('let b:nn = 4')
eq('ef', eval('str[b:nn:]'))
eq('abcde', eval('str[:b:nn]'))
eq('e', eval('str[b:nn:b:nn]'))
end)
end)