To: vim_dev@googlegroups.com Subject: Patch 8.1.0164 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0164 Problem: luaeval('vim.buffer().name') returns an error. Solution: Return an empty string. (Dominique Pelle, closes #3167) Files: src/if_lua.c, src/testdir/test_lua.vim *** ../vim-8.1.0163/src/if_lua.c Sun Jul 1 15:12:00 2018 --- src/if_lua.c Sat Jul 7 23:04:53 2018 *************** *** 1123,1131 **** { const char *s = lua_tostring(L, 2); if (strncmp(s, "name", 4) == 0) ! lua_pushstring(L, (char *) b->b_sfname); else if (strncmp(s, "fname", 5) == 0) ! lua_pushstring(L, (char *) b->b_ffname); else if (strncmp(s, "number", 6) == 0) lua_pushinteger(L, b->b_fnum); /* methods */ --- 1123,1133 ---- { const char *s = lua_tostring(L, 2); if (strncmp(s, "name", 4) == 0) ! lua_pushstring(L, (b->b_sfname == NULL) ! ? "" : (char *) b->b_sfname); else if (strncmp(s, "fname", 5) == 0) ! lua_pushstring(L, (b->b_ffname == NULL) ! ? "" : (char *) b->b_ffname); else if (strncmp(s, "number", 6) == 0) lua_pushinteger(L, b->b_fnum); /* methods */ *** ../vim-8.1.0163/src/testdir/test_lua.vim Mon Jul 2 22:54:32 2018 --- src/testdir/test_lua.vim Sat Jul 7 23:04:53 2018 *************** *** 198,208 **** " Test vim.buffer().name and vim.buffer().fname func Test_buffer_name() new ! " FIXME: for an unnamed buffer, I would expect ! " vim.buffer().name to give an empty string, but ! " it returns 0. Is it a bug? ! " so this assert_equal is commented out. ! " call assert_equal('', luaeval('vim.buffer().name')) bwipe! new Xfoo --- 198,205 ---- " Test vim.buffer().name and vim.buffer().fname func Test_buffer_name() new ! call assert_equal('', luaeval('vim.buffer().name')) ! call assert_equal('', luaeval('vim.buffer().fname')) bwipe! new Xfoo *** ../vim-8.1.0163/src/version.c Sat Jul 7 22:41:57 2018 --- src/version.c Sat Jul 7 23:06:18 2018 *************** *** 791,792 **** --- 791,794 ---- { /* Add new patch number below this line */ + /**/ + 164, /**/ -- Spam seems to be something useful to novices. Later you realize that it's a bunch of indigestable junk that only clogs your system. Applies to both the food and the e-mail! /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///