Patch 8.2.3367
Problem:    Vim9: :@r executing a register is inconsistent.
Solution:   Use "@r" as the start of an expression. (issue #8779)
Files:      src/ex_docmd.c, src/testdir/test_vim9_cmd.vim


*** ../vim-8.2.3366/src/ex_docmd.c      2021-08-21 20:50:31.210336766 +0200
--- src/ex_docmd.c      2021-08-22 22:43:16.343970139 +0200
***************
*** 3432,3443 ****
            int     heredoc;
            char_u  *swp;
  
!           if (*eap->cmd == '&')
            {
!               p = to_name_end(eap->cmd + 1, FALSE);
                if (ends_excmd(*skipwhite(p)))
                {
!                   // "&option <NL>" is the start of an expression.
                    eap->cmdidx = CMD_eval;
                    return eap->cmd;
                }
--- 3432,3454 ----
            int     heredoc;
            char_u  *swp;
  
!           if (*eap->cmd == '&' || (eap->cmd[0] == '@'
!                                       && (valid_yank_reg(eap->cmd[1], FALSE)
!                                                      || eap->cmd[1] == '@')))
            {
!               if (*eap->cmd == '&')
!               {
!                   p = eap->cmd + 1;
!                   if (STRNCMP("l:", p, 2) == 0 || STRNCMP("g:", p, 2) == 0)
!                       p += 2;
!                   p = to_name_end(p, FALSE);
!               }
!               else
!                   p = eap->cmd + 2;
                if (ends_excmd(*skipwhite(p)))
                {
!                   // "&option <NL>" and "@r <NL>" is the start of an
!                   // expression.
                    eap->cmdidx = CMD_eval;
                    return eap->cmd;
                }
***************
*** 3548,3557 ****
            // "&opt = expr"
            // "var = expr"  where "var" is a variable name or we are skipping
            // (variable declaration might have been skipped).
-           if (*eap->cmd == '@')
-               p = eap->cmd + 2;
-           else if (*eap->cmd == '&')
-               p = skiptowhite_esc(eap->cmd + 1);
            oplen = assignment_len(skipwhite(p), &heredoc);
            if (oplen > 0)
            {
--- 3559,3564 ----
*** ../vim-8.2.3366/src/testdir/test_vim9_cmd.vim       2021-08-21 
20:50:31.210336766 +0200
--- src/testdir/test_vim9_cmd.vim       2021-08-22 22:18:23.643226322 +0200
***************
*** 537,542 ****
--- 537,558 ----
    CheckDefAndScriptSuccess(lines)
  enddef
  
+ def Test_register_use_linebreak()
+   var lines =<< trim END
+       new
+       @a = 'one'
+       @a->setline(1)
+       @b = 'two'
+       @b   ->setline(2)
+       @c = 'three'
+       @c  
+           ->setline(3)
+       assert_equal(['one', 'two', 'three'], getline(1, '$'))
+       bwipe!
+   END
+   CheckDefAndScriptSuccess(lines)
+ enddef
+ 
  def Test_skipped_expr_linebreak()
    if 0
      var x = []
*** ../vim-8.2.3366/src/version.c       2021-08-22 13:34:23.423960112 +0200
--- src/version.c       2021-08-22 22:20:08.826999586 +0200
***************
*** 757,758 ****
--- 757,760 ----
  {   /* Add new patch number below this line */
+ /**/
+     3367,
  /**/

-- 
TERRY GILLIAM PLAYED: PATSY (ARTHUR'S TRUSTY STEED), THE GREEN KNIGHT
                      SOOTHSAYER, BRIDGEKEEPER, SIR GAWAIN (THE FIRST TO BE
                      KILLED BY THE RABBIT)
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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/202108222045.17MKj5CB1473100%40masaka.moolenaar.net.

Raspunde prin e-mail lui