changeset 28055:5bf3ed75e26c v8.2.4552

patch 8.2.4552: in a :def function "put = expr" does not work Commit: https://github.com/vim/vim/commit/d0b7bfa95798f5ec743d8afffbffb83aeac823da Author: Bram Moolenaar <Bram@vim.org> Date: Sat Mar 12 14:51:16 2022 +0000 patch 8.2.4552: in a :def function "put = expr" does not work Problem: In a :def function "put = expr" does not work. Solution: Skip over white space. (closes https://github.com/vim/vim/issues/9936)
author Bram Moolenaar <Bram@vim.org>
date Sat, 12 Mar 2022 16:00:03 +0100
parents b31d4f3d2af9
children fa0290f89c7b
files src/testdir/test_vim9_cmd.vim src/version.c src/vim9cmds.c
diffstat 3 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/testdir/test_vim9_cmd.vim
+++ b/src/testdir/test_vim9_cmd.vim
@@ -1217,7 +1217,7 @@ def Test_put_command()
   :2put =['a', 'b', 'c']
   assert_equal(['ppp', 'a', 'b', 'c', 'above'], getline(2, 6))
 
-  :0put ='first'
+  :0put =  'first'
   assert_equal('first', getline(1))
   :1put! ='first again'
   assert_equal('first again', getline(1))
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    4552,
+/**/
     4551,
 /**/
     4550,
--- a/src/vim9cmds.c
+++ b/src/vim9cmds.c
@@ -1767,7 +1767,7 @@ compile_put(char_u *arg, exarg_T *eap, c
 
     if (eap->regname == '=')
     {
-	char_u *p = line + 1;
+	char_u *p = skipwhite(line + 1);
 
 	if (compile_expr0(&p, cctx) == FAIL)
 	    return NULL;