summaryrefslogtreecommitdiffstats
path: root/src/ex_docmd.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-08-22 22:44:11 +0200
committerBram Moolenaar <Bram@vim.org>2021-08-22 22:44:11 +0200
commit73170917f14d1b0d919c65fbc0a9d011b87d94da (patch)
tree6ee99f847cbd30b9be296122e3d2ecc501cd5bdf /src/ex_docmd.c
parent093165c899f1620543844d1c1a7a05975697c286 (diff)
patch 8.2.3367: Vim9: :@r executing a register is inconsistentv8.2.3367
Problem: Vim9: :@r executing a register is inconsistent. Solution: Use "@r" as the start of an expression. (issue #8779)
Diffstat (limited to 'src/ex_docmd.c')
-rw-r--r--src/ex_docmd.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 4eee8fe9ce..85df6cdc27 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -3432,12 +3432,23 @@ find_ex_command(
int heredoc;
char_u *swp;
- if (*eap->cmd == '&')
+ if (*eap->cmd == '&' || (eap->cmd[0] == '@'
+ && (valid_yank_reg(eap->cmd[1], FALSE)
+ || eap->cmd[1] == '@')))
{
- p = to_name_end(eap->cmd + 1, FALSE);
+ 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>" is the start of an expression.
+ // "&option <NL>" and "@r <NL>" is the start of an
+ // expression.
eap->cmdidx = CMD_eval;
return eap->cmd;
}
@@ -3548,10 +3559,6 @@ find_ex_command(
// "&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)
{