Patch 8.2.4971

4 views
Skip to first unread message

Bram Moolenaar

unread,
May 17, 2022, 8:17:06 AM5/17/22
to vim...@googlegroups.com

Patch 8.2.4971
Problem: Vim9: interpolated string seen as range.
Solution: Recognize an interpolated string at the start of a command line.
(closes #10434)
Files: src/ex_docmd.c, src/testdir/test_vim9_expr.vim


*** ../vim-8.2.4970/src/ex_docmd.c 2022-05-09 20:09:19.282641427 +0100
--- src/ex_docmd.c 2022-05-17 12:52:52.301347304 +0100
***************
*** 3551,3557 ****
char_u *swp;

if (*eap->cmd == '&'
! || *eap->cmd == '$'
|| (eap->cmd[0] == '@'
&& (valid_yank_reg(eap->cmd[1], FALSE)
|| eap->cmd[1] == '@')))
--- 3551,3558 ----
char_u *swp;

if (*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,3598 ****
// "'string'->func()" is an expression.
|| *eap->cmd == '\''
// '"string"->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] == ':'
)
--- 3591,3603 ----
// "'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')
// "g:varname" is an expression.
|| eap->cmd[1] == ':'
)
*** ../vim-8.2.4970/src/testdir/test_vim9_expr.vim 2022-05-13 16:23:33.793284093 +0100
--- src/testdir/test_vim9_expr.vim 2022-05-17 13:01:43.405086985 +0100
***************
*** 3572,3578 ****
setline(1, ['first', 'last'])
'second'->append(1)
"third"->append(2)
! assert_equal(['first', 'second', 'third', 'last'], getline(1, '$'))
bwipe!

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

var bufnr = bufnr()
*** ../vim-8.2.4970/src/version.c 2022-05-17 12:45:11.789423526 +0100
--- src/version.c 2022-05-17 13:02:27.113061529 +0100
***************
*** 748,749 ****
--- 748,751 ----
{ /* Add new patch number below this line */
+ /**/
+ 4971,
/**/

--
hundred-and-one symptoms of being an internet addict:
220. Your wife asks for sex and you tell her where to find you on IRC.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages