To: vim_dev@googlegroups.com Subject: Patch 8.2.3367 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ 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 " 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 " and "@r " 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 -- Bram@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 ///