diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-09-08 22:45:35 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-09-08 22:45:35 +0200 |
commit | c3516f7e4507c77424b94cb89071f6d0841f4e6a (patch) | |
tree | 08b13ec0f9f8b88e0ec8cbab01899960dae3423b /src/register.c | |
parent | 6defa7bf0a8935cc44f3dc12e9c87bbb40f190b7 (diff) | |
download | vim-git-c3516f7e4507c77424b94cb89071f6d0841f4e6a.tar.gz |
patch 8.2.1637: Vim9: :put ={expr} does not work inside :def functionv8.2.1637
Problem: Vim9: :put ={expr} does not work inside :def function.
Solution: Add ISN_PUT. (closes #6397)
Diffstat (limited to 'src/register.c')
-rw-r--r-- | src/register.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/register.c b/src/register.c index 61b6b2c25..ca74aee90 100644 --- a/src/register.c +++ b/src/register.c @@ -1487,6 +1487,7 @@ copy_yank_reg(yankreg_T *reg) void do_put( int regname, + char_u *expr_result, // result for regname "=" when compiled int dir, // BACKWARD for 'P', FORWARD for 'p' long count, int flags) @@ -1551,11 +1552,12 @@ do_put( // For special registers '%' (file name), '#' (alternate file name) and // ':' (last command line), etc. we have to create a fake yank register. - if (get_spec_reg(regname, &insert_string, &allocated, TRUE)) - { - if (insert_string == NULL) - return; - } + // For compiled code "expr_result" holds the expression result. + if (regname == '=' && expr_result != NULL) + insert_string = expr_result; + else if (get_spec_reg(regname, &insert_string, &allocated, TRUE) + && insert_string == NULL) + return; // Autocommands may be executed when saving lines for undo. This might // make "y_array" invalid, so we start undo now to avoid that. |