comparison src/ex_docmd.c @ 25662:23f065f27d2e v8.2.3367

patch 8.2.3367: Vim9: :@r executing a register is inconsistent Commit: https://github.com/vim/vim/commit/73170917f14d1b0d919c65fbc0a9d011b87d94da Author: Bram Moolenaar <Bram@vim.org> Date: Sun Aug 22 22:44:11 2021 +0200 patch 8.2.3367: Vim9: :@r executing a register is inconsistent Problem: Vim9: :@r executing a register is inconsistent. Solution: Use "@r" as the start of an expression. (issue https://github.com/vim/vim/issues/8779)
author Bram Moolenaar <Bram@vim.org>
date Sun, 22 Aug 2021 22:45:03 +0200
parents 483b40e87ca5
children 812c75fd255c
comparison
equal deleted inserted replaced
25661:cb69ba1652c6 25662:23f065f27d2e
3430 { 3430 {
3431 int oplen; 3431 int oplen;
3432 int heredoc; 3432 int heredoc;
3433 char_u *swp; 3433 char_u *swp;
3434 3434
3435 if (*eap->cmd == '&') 3435 if (*eap->cmd == '&' || (eap->cmd[0] == '@'
3436 && (valid_yank_reg(eap->cmd[1], FALSE)
3437 || eap->cmd[1] == '@')))
3436 { 3438 {
3437 p = to_name_end(eap->cmd + 1, FALSE); 3439 if (*eap->cmd == '&')
3440 {
3441 p = eap->cmd + 1;
3442 if (STRNCMP("l:", p, 2) == 0 || STRNCMP("g:", p, 2) == 0)
3443 p += 2;
3444 p = to_name_end(p, FALSE);
3445 }
3446 else
3447 p = eap->cmd + 2;
3438 if (ends_excmd(*skipwhite(p))) 3448 if (ends_excmd(*skipwhite(p)))
3439 { 3449 {
3440 // "&option <NL>" is the start of an expression. 3450 // "&option <NL>" and "@r <NL>" is the start of an
3451 // expression.
3441 eap->cmdidx = CMD_eval; 3452 eap->cmdidx = CMD_eval;
3442 return eap->cmd; 3453 return eap->cmd;
3443 } 3454 }
3444 // "&option" can be followed by "->" or "=", check below 3455 // "&option" can be followed by "->" or "=", check below
3445 } 3456 }
3546 // "g:var = expr" 3557 // "g:var = expr"
3547 // "@r = expr" 3558 // "@r = expr"
3548 // "&opt = expr" 3559 // "&opt = expr"
3549 // "var = expr" where "var" is a variable name or we are skipping 3560 // "var = expr" where "var" is a variable name or we are skipping
3550 // (variable declaration might have been skipped). 3561 // (variable declaration might have been skipped).
3551 if (*eap->cmd == '@')
3552 p = eap->cmd + 2;
3553 else if (*eap->cmd == '&')
3554 p = skiptowhite_esc(eap->cmd + 1);
3555 oplen = assignment_len(skipwhite(p), &heredoc); 3562 oplen = assignment_len(skipwhite(p), &heredoc);
3556 if (oplen > 0) 3563 if (oplen > 0)
3557 { 3564 {
3558 if (((p - eap->cmd) > 2 && eap->cmd[1] == ':') 3565 if (((p - eap->cmd) > 2 && eap->cmd[1] == ':')
3559 || *eap->cmd == '&' 3566 || *eap->cmd == '&'