patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Problem: Vim9: :put ={expr} does not work inside :def function.
Solution: Add ISN_PUT. (closes #6397)
diff --git a/src/register.c b/src/register.c
index 61b6b2c..ca74aee 100644
--- a/src/register.c
+++ b/src/register.c
@@ -1487,6 +1487,7 @@
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 @@
// 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.