]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.3240: Lua print() does not work properly v8.2.3240
authorBram Moolenaar <Bram@vim.org>
Wed, 28 Jul 2021 19:48:59 +0000 (21:48 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 28 Jul 2021 19:48:59 +0000 (21:48 +0200)
Problem:    Lua print() does not work properly.
Solution:   Put back lua_pop().

src/if_lua.c
src/testdir/test_lua.vim
src/version.c

index 79fb68168bbedbb57327f4185f08c8060fb6627d..5810401633b2fb055625a867e7cc0ac60401ee8a 100644 (file)
@@ -1737,6 +1737,7 @@ luaV_print(lua_State *L)
        if (i > 1)
            luaL_addchar(&b, ' '); // use space instead of tab
        luaV_addlstring(&b, s, l, 0);
+       lua_pop(L, 1);
     }
     luaL_pushresult(&b);
     if (!got_int)
index 2f204048f6f3c51ab12eb65bd24bfbdcec862c54..c30f9597ea3abf77efd2740e156923cdee00632d 100644 (file)
@@ -870,8 +870,8 @@ endfunc
 
 " Test for dealing with strings containing newlines and null character
 func Test_lua_string_with_newline()
-  let x = execute('lua print("Hello\nWorld")')
-  call assert_equal("\nHello\nWorld", x)
+  let x = execute('lua print("Hello\nWorld", 2)')
+  call assert_equal("\nHello\nWorld 2", x)
   new
   lua k = vim.buffer(vim.eval('bufnr()'))
   lua k:insert("Hello\0World", 0)
index b705749aab1f5e3d5878231e99046b383f734000..13b6425dc8c0bc5851e0e73f9091f32ea0c4c8db 100644 (file)
@@ -755,6 +755,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3240,
 /**/
     3239,
 /**/