diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-10-28 13:53:50 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-10-28 13:53:50 +0100 |
commit | b4bcea474d9006e4db1fa5d6828773e739af14bb (patch) | |
tree | 1cef0b7161b2d71b8d826917f2bf2f60931d4840 /src/register.c | |
parent | 70cf45810cb9be5bd17074f7fb4ee238f2c4d57b (diff) | |
download | vim-git-b4bcea474d9006e4db1fa5d6828773e739af14bb.tar.gz |
patch 8.2.1914: Vim9: cannot put line break in expression for '=' registerv8.2.1914
Problem: Vim9: cannot put line break in expression for '=' register.
Solution: Pass fgetline to set_expr_line(). (closes #7209)
Diffstat (limited to 'src/register.c')
-rw-r--r-- | src/register.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/register.c b/src/register.c index 4c7c51138..625150db2 100644 --- a/src/register.c +++ b/src/register.c @@ -79,6 +79,7 @@ set_y_previous(yankreg_T *yreg) * Keep the last expression line here, for repeating. */ static char_u *expr_line = NULL; +static exarg_T *expr_eap = NULL; /* * Get an expression for the "\"=expr1" or "CTRL-R =expr1" @@ -95,19 +96,22 @@ get_expr_register(void) if (*new_line == NUL) // use previous line vim_free(new_line); else - set_expr_line(new_line); + set_expr_line(new_line, NULL); return '='; } /* * Set the expression for the '=' register. * Argument must be an allocated string. + * "eap" may be used if the next line needs to be checked when evaluating the + * expression. */ void -set_expr_line(char_u *new_line) +set_expr_line(char_u *new_line, exarg_T *eap) { vim_free(expr_line); expr_line = new_line; + expr_eap = eap; } /* @@ -136,7 +140,7 @@ get_expr_line(void) return expr_copy; ++nested; - rv = eval_to_string(expr_copy, TRUE); + rv = eval_to_string_eap(expr_copy, TRUE, expr_eap); --nested; vim_free(expr_copy); return rv; @@ -2774,7 +2778,7 @@ write_reg_contents_ex( vim_free(p); p = s; } - set_expr_line(p); + set_expr_line(p, NULL); return; } |