Mercurial > vim
changeset 28897:37e05627acb1 v8.2.4971
patch 8.2.4971: Vim9: interpolated string seen as range
Commit: https://github.com/vim/vim/commit/40c141d333292d625907f4de13766cbbc2223911
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue May 17 13:14:23 2022 +0100
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 17 May 2022 14:15:02 +0200 |
parents | 915bc19857dd |
children | 61a6cd224f07 |
files | src/ex_docmd.c src/testdir/test_vim9_expr.vim src/version.c |
diffstat | 3 files changed, 13 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -3551,7 +3551,8 @@ find_ex_command( char_u *swp; if (*eap->cmd == '&' - || *eap->cmd == '$' + || (eap->cmd[0] == '$' + && eap->cmd[1] != '\'' && eap->cmd[1] != '"') || (eap->cmd[0] == '@' && (valid_yank_reg(eap->cmd[1], FALSE) || eap->cmd[1] == '@'))) @@ -3590,9 +3591,13 @@ find_ex_command( // "'string'->func()" is an expression. || *eap->cmd == '\'' // '"string"->func()' is an expression. + || *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') - // '"string"->func()' is an expression. - || *eap->cmd == '"' // "g:varname" is an expression. || eap->cmd[1] == ':' )
--- a/src/testdir/test_vim9_expr.vim +++ b/src/testdir/test_vim9_expr.vim @@ -3572,7 +3572,9 @@ def Test_expr8_method_call() setline(1, ['first', 'last']) 'second'->append(1) "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! var bufnr = bufnr()