summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0164
blob: a4982fcb9232a0ea638971c69f9d6389b75359f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0164
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
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    ///