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 -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220517121702.473821C07AB%40moolenaar.net.

Raspunde prin e-mail lui