changeset 25407:241d26b17192 v8.2.3240

patch 8.2.3240: Lua print() does not work properly Commit: https://github.com/vim/vim/commit/2a4bd00cef1a291059903e26a126b84718e47804 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jul 28 21:48:59 2021 +0200 patch 8.2.3240: Lua print() does not work properly Problem: Lua print() does not work properly. Solution: Put back lua_pop().
author Bram Moolenaar <Bram@vim.org>
date Wed, 28 Jul 2021 22:00:05 +0200
parents 54392bb0e0ed
children 58603ea67d8e
files src/if_lua.c src/testdir/test_lua.vim src/version.c
diffstat 3 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/if_lua.c
+++ b/src/if_lua.c
@@ -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)
--- a/src/testdir/test_lua.vim
+++ b/src/testdir/test_lua.vim
@@ -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)
--- a/src/version.c
+++ b/src/version.c
@@ -756,6 +756,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    3240,
+/**/
     3239,
 /**/
     3238,