mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.1.0164: luaeval('vim.buffer().name') returns an error
Problem: luaeval('vim.buffer().name') returns an error. Solution: Return an empty string. (Dominique Pelle, closes #3167)
This commit is contained in:
parent
2549acf794
commit
fe08df452a
@ -1123,9 +1123,11 @@ luaV_buffer_index(lua_State *L)
|
|||||||
{
|
{
|
||||||
const char *s = lua_tostring(L, 2);
|
const char *s = lua_tostring(L, 2);
|
||||||
if (strncmp(s, "name", 4) == 0)
|
if (strncmp(s, "name", 4) == 0)
|
||||||
lua_pushstring(L, (char *) b->b_sfname);
|
lua_pushstring(L, (b->b_sfname == NULL)
|
||||||
|
? "" : (char *) b->b_sfname);
|
||||||
else if (strncmp(s, "fname", 5) == 0)
|
else if (strncmp(s, "fname", 5) == 0)
|
||||||
lua_pushstring(L, (char *) b->b_ffname);
|
lua_pushstring(L, (b->b_ffname == NULL)
|
||||||
|
? "" : (char *) b->b_ffname);
|
||||||
else if (strncmp(s, "number", 6) == 0)
|
else if (strncmp(s, "number", 6) == 0)
|
||||||
lua_pushinteger(L, b->b_fnum);
|
lua_pushinteger(L, b->b_fnum);
|
||||||
/* methods */
|
/* methods */
|
||||||
|
@ -198,11 +198,8 @@ endfunc
|
|||||||
" Test vim.buffer().name and vim.buffer().fname
|
" Test vim.buffer().name and vim.buffer().fname
|
||||||
func Test_buffer_name()
|
func Test_buffer_name()
|
||||||
new
|
new
|
||||||
" FIXME: for an unnamed buffer, I would expect
|
call assert_equal('', luaeval('vim.buffer().name'))
|
||||||
" vim.buffer().name to give an empty string, but
|
call assert_equal('', luaeval('vim.buffer().fname'))
|
||||||
" it returns 0. Is it a bug?
|
|
||||||
" so this assert_equal is commented out.
|
|
||||||
" call assert_equal('', luaeval('vim.buffer().name'))
|
|
||||||
bwipe!
|
bwipe!
|
||||||
|
|
||||||
new Xfoo
|
new Xfoo
|
||||||
|
@ -789,6 +789,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
164,
|
||||||
/**/
|
/**/
|
||||||
163,
|
163,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user