0
0
mirror of https://github.com/vim/vim.git synced 2025-11-13 22:54:27 -05:00

patch 8.2.4971: Vim9: interpolated string seen as range

Problem:    Vim9: interpolated string seen as range.
Solution:   Recognize an interpolated string at the start of a command line.
            (closes #10434)
This commit is contained in:
Bram Moolenaar
2022-05-17 13:14:23 +01:00
parent 0d03263fd7
commit 40c141d333
3 changed files with 13 additions and 4 deletions

View File

@@ -3551,7 +3551,8 @@ find_ex_command(
char_u *swp; char_u *swp;
if (*eap->cmd == '&' if (*eap->cmd == '&'
|| *eap->cmd == '$' || (eap->cmd[0] == '$'
&& eap->cmd[1] != '\'' && eap->cmd[1] != '"')
|| (eap->cmd[0] == '@' || (eap->cmd[0] == '@'
&& (valid_yank_reg(eap->cmd[1], FALSE) && (valid_yank_reg(eap->cmd[1], FALSE)
|| eap->cmd[1] == '@'))) || eap->cmd[1] == '@')))
@@ -3590,9 +3591,13 @@ find_ex_command(
// "'string'->func()" is an expression. // "'string'->func()" is an expression.
|| *eap->cmd == '\'' || *eap->cmd == '\''
// '"string"->func()' is an expression. // '"string"->func()' is an expression.
|| (eap->cmd[0] == '0' && eap->cmd[1] == 'z')
// '"string"->func()' is an expression.
|| *eap->cmd == '"' || *eap->cmd == '"'
// '$"string"->func()' is an expression.
// "$'string'->func()" is an expression.
|| (eap->cmd[0] == '$'
&& (eap->cmd[1] == '\'' || eap->cmd[1] == '"'))
// '0z1234->func()' is an expression.
|| (eap->cmd[0] == '0' && eap->cmd[1] == 'z')
// "g:varname" is an expression. // "g:varname" is an expression.
|| eap->cmd[1] == ':' || eap->cmd[1] == ':'
) )

View File

@@ -3572,7 +3572,9 @@ def Test_expr8_method_call()
setline(1, ['first', 'last']) setline(1, ['first', 'last'])
'second'->append(1) 'second'->append(1)
"third"->append(2) "third"->append(2)
assert_equal(['first', 'second', 'third', 'last'], getline(1, '$')) $"fourth"->append(3)
$'fifth'->append(4)
assert_equal(['first', 'second', 'third', 'fourth', 'fifth', 'last'], getline(1, '$'))
bwipe! bwipe!
var bufnr = bufnr() var bufnr = bufnr()

View File

@@ -746,6 +746,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
4971,
/**/ /**/
4970, 4970,
/**/ /**/