Skip to content

Commit 3392883

Browse files
committed
patch 7.4.2226
Problem: The field names used by getbufinfo(), gettabinfo() and getwininfo() are not consistent. Solution: Use bufnr, winnr and tabnr. (Yegappan Lakshmanan)
1 parent bfd096d commit 3392883

4 files changed

Lines changed: 14 additions & 12 deletions

File tree

runtime/doc/eval.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4004,14 +4004,14 @@ getbufinfo([{dict}])
40044004

40054005
Each returned List item is a dictionary with the following
40064006
entries:
4007+
bufnr buffer number.
40074008
changed TRUE if the buffer is modified.
40084009
changedtick number of changes made to the buffer.
40094010
hidden TRUE if the buffer is hidden.
40104011
listed TRUE if the buffer is listed.
40114012
lnum current line number in buffer.
40124013
loaded TRUE if the buffer is loaded.
40134014
name full path to the file in the buffer.
4014-
nr buffer number.
40154015
options dictionary of buffer local options.
40164016
signs list of signs placed in the buffer.
40174017
Each list item is a dictionary with

src/evalfunc.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3931,7 +3931,7 @@ get_buffer_info(buf_T *buf)
39313931
if (dict == NULL)
39323932
return NULL;
39333933

3934-
dict_add_nr_str(dict, "nr", buf->b_fnum, NULL);
3934+
dict_add_nr_str(dict, "bufnr", buf->b_fnum, NULL);
39353935
dict_add_nr_str(dict, "name", 0L,
39363936
buf->b_ffname != NULL ? buf->b_ffname : (char_u *)"");
39373937
dict_add_nr_str(dict, "lnum", buflist_findlnum(buf), NULL);
@@ -5001,7 +5001,7 @@ get_tabpage_info(tabpage_T *tp, int tp_idx)
50015001
if (dict == NULL)
50025002
return NULL;
50035003

5004-
dict_add_nr_str(dict, "nr", tp_idx, NULL);
5004+
dict_add_nr_str(dict, "tabnr", tp_idx, NULL);
50055005

50065006
l = list_alloc();
50075007
if (l != NULL)
@@ -5125,12 +5125,12 @@ get_win_info(win_T *wp, short tpnr, short winnr)
51255125
if (dict == NULL)
51265126
return NULL;
51275127

5128-
dict_add_nr_str(dict, "tpnr", tpnr, NULL);
5129-
dict_add_nr_str(dict, "nr", winnr, NULL);
5128+
dict_add_nr_str(dict, "tabnr", tpnr, NULL);
5129+
dict_add_nr_str(dict, "winnr", winnr, NULL);
51305130
dict_add_nr_str(dict, "winid", wp->w_id, NULL);
51315131
dict_add_nr_str(dict, "height", wp->w_height, NULL);
51325132
dict_add_nr_str(dict, "width", wp->w_width, NULL);
5133-
dict_add_nr_str(dict, "bufnum", wp->w_buffer->b_fnum, NULL);
5133+
dict_add_nr_str(dict, "bufnr", wp->w_buffer->b_fnum, NULL);
51345134

51355135
#ifdef FEAT_QUICKFIX
51365136
dict_add_nr_str(dict, "quickfix", bt_quickfix(wp->w_buffer), NULL);

src/testdir/test_bufwintabinfo.vim

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function Test_getbufwintabinfo()
1717
set tabstop&vim
1818
let b:editor = 'vim'
1919
let l = getbufinfo('%')
20-
call assert_equal(bufnr('%'), l[0].nr)
20+
call assert_equal(bufnr('%'), l[0].bufnr)
2121
call assert_equal(8, l[0].options.tabstop)
2222
call assert_equal('vim', l[0].variables.editor)
2323
call assert_notequal(-1, index(l[0].windows, bufwinid('%')))
@@ -46,25 +46,25 @@ function Test_getbufwintabinfo()
4646
tabfirst
4747
let winlist = getwininfo()
4848
call assert_equal(5, len(winlist))
49-
call assert_equal(winbufnr(2), winlist[1].bufnum)
49+
call assert_equal(winbufnr(2), winlist[1].bufnr)
5050
call assert_equal(winheight(2), winlist[1].height)
51-
call assert_equal(1, winlist[2].nr)
51+
call assert_equal(1, winlist[2].winnr)
5252
if has('signs')
5353
call assert_equal('auto', winlist[0].options.signcolumn)
5454
endif
55-
call assert_equal(2, winlist[3].tpnr)
55+
call assert_equal(2, winlist[3].tabnr)
5656
call assert_equal('green', winlist[2].variables.signal)
5757
call assert_equal(winwidth(1), winlist[0].width)
5858
call assert_equal(w4_id, winlist[3].winid)
5959
let winfo = getwininfo(w5_id)[0]
60-
call assert_equal(2, winfo.tpnr)
60+
call assert_equal(2, winfo.tabnr)
6161
call assert_equal([], getwininfo(3))
6262

6363
call settabvar(1, 'space', 'build')
6464
let tablist = gettabinfo()
6565
call assert_equal(2, len(tablist))
6666
call assert_equal(3, len(tablist[1].windows))
67-
call assert_equal(2, tablist[1].nr)
67+
call assert_equal(2, tablist[1].tabnr)
6868
call assert_equal('build', tablist[0].variables.space)
6969
call assert_equal(w2_id, tablist[0].windows[0])
7070
call assert_equal([], gettabinfo(3))

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,8 @@ static char *(features[]) =
763763

764764
static int included_patches[] =
765765
{ /* Add new patch number below this line */
766+
/**/
767+
2226,
766768
/**/
767769
2225,
768770
/**/

0 commit comments

Comments
 (0)