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)
Files: runtime/doc/eval.txt, src/evalfunc.c,
src/testdir/test_bufwintabinfo.vim
*** ../vim-7.4.2225/runtime/doc/eval.txt 2016-08-16 21:58:36.726878365
+0200
--- runtime/doc/eval.txt 2016-08-18 20:53:31.978015048 +0200
***************
*** 3975,3980 ****
--- 4005,4011 ----
Each returned List item is a dictionary with the following
entries:
+ bufnr buffer number.
changed TRUE if the buffer is modified.
changedtick number of changes made to the buffer.
hidden TRUE if the buffer is hidden.
***************
*** 3982,3988 ****
lnum current line number in buffer.
loaded TRUE if the buffer is loaded.
name full path to the file in the buffer.
- nr buffer number.
options dictionary of buffer local options.
signs list of signs placed in the buffer.
Each list item is a dictionary with
--- 4013,4018 ----
***************
*** 4484,4492 ****
empty List is returned.
Each List item is a Dictionary with the following entries:
! nr tab page number.
! windows List of window IDs in the tag page.
variables dictionary of tabpage local variables.
gettabvar({tabnr}, {varname} [, {def}])
*gettabvar()*
Get the value of a tab-local variable {varname} in tab page
--- 4530,4538 ----
empty List is returned.
Each List item is a Dictionary with the following entries:
! tabnr tab page number.
variables dictionary of tabpage local variables.
+ windows List of window IDs in the tag page.
gettabvar({tabnr}, {varname} [, {def}])
*gettabvar()*
Get the value of a tab-local variable {varname} in tab page
***************
*** 4540,4555 ****
pages is returned.
Each List item is a Dictionary with the following entries:
! bufnum number of buffer in the window
height window height
loclist 1 if showing a location list
! nr window number
options dictionary of window local options
quickfix 1 if quickfix or location list window
! tpnr tab page number
variables dictionary of window local variables
width window width
winid window ID
getwinvar({winnr}, {varname} [, {def}])
*getwinvar()*
Like |gettabwinvar()| for the current tabpage.
--- 4586,4603 ----
pages is returned.
Each List item is a Dictionary with the following entries:
! bufnr number of buffer in the window
height window height
loclist 1 if showing a location list
! {only with the +quickfix feature}
options dictionary of window local options
quickfix 1 if quickfix or location list window
! {only with the +quickfix feature}
! tabnr tab page number
variables dictionary of window local variables
width window width
winid window ID
+ winnr window number
getwinvar({winnr}, {varname} [, {def}])
*getwinvar()*
Like |gettabwinvar()| for the current tabpage.
*** ../vim-7.4.2225/src/evalfunc.c 2016-08-17 21:51:52.255045652 +0200
--- src/evalfunc.c 2016-08-18 20:53:31.982015014 +0200
***************
*** 3931,3937 ****
if (dict == NULL)
return NULL;
! dict_add_nr_str(dict, "nr", buf->b_fnum, NULL);
dict_add_nr_str(dict, "name", 0L,
buf->b_ffname != NULL ? buf->b_ffname : (char_u *)"");
dict_add_nr_str(dict, "lnum", buflist_findlnum(buf), NULL);
--- 3931,3937 ----
if (dict == NULL)
return NULL;
! dict_add_nr_str(dict, "bufnr", buf->b_fnum, NULL);
dict_add_nr_str(dict, "name", 0L,
buf->b_ffname != NULL ? buf->b_ffname : (char_u *)"");
dict_add_nr_str(dict, "lnum", buflist_findlnum(buf), NULL);
***************
*** 5001,5007 ****
if (dict == NULL)
return NULL;
! dict_add_nr_str(dict, "nr", tp_idx, NULL);
l = list_alloc();
if (l != NULL)
--- 5001,5007 ----
if (dict == NULL)
return NULL;
! dict_add_nr_str(dict, "tabnr", tp_idx, NULL);
l = list_alloc();
if (l != NULL)
***************
*** 5125,5136 ****
if (dict == NULL)
return NULL;
! dict_add_nr_str(dict, "tpnr", tpnr, NULL);
! dict_add_nr_str(dict, "nr", winnr, NULL);
dict_add_nr_str(dict, "winid", wp->w_id, NULL);
dict_add_nr_str(dict, "height", wp->w_height, NULL);
dict_add_nr_str(dict, "width", wp->w_width, NULL);
! dict_add_nr_str(dict, "bufnum", wp->w_buffer->b_fnum, NULL);
#ifdef FEAT_QUICKFIX
dict_add_nr_str(dict, "quickfix", bt_quickfix(wp->w_buffer), NULL);
--- 5125,5136 ----
if (dict == NULL)
return NULL;
! dict_add_nr_str(dict, "tabnr", tpnr, NULL);
! dict_add_nr_str(dict, "winnr", winnr, NULL);
dict_add_nr_str(dict, "winid", wp->w_id, NULL);
dict_add_nr_str(dict, "height", wp->w_height, NULL);
dict_add_nr_str(dict, "width", wp->w_width, NULL);
! dict_add_nr_str(dict, "bufnr", wp->w_buffer->b_fnum, NULL);
#ifdef FEAT_QUICKFIX
dict_add_nr_str(dict, "quickfix", bt_quickfix(wp->w_buffer), NULL);
*** ../vim-7.4.2225/src/testdir/test_bufwintabinfo.vim 2016-08-15
22:54:45.988943405 +0200
--- src/testdir/test_bufwintabinfo.vim 2016-08-18 20:59:26.594861011 +0200
***************
*** 17,23 ****
set tabstop&vim
let b:editor = 'vim'
let l = getbufinfo('%')
! call assert_equal(bufnr('%'), l[0].nr)
call assert_equal(8, l[0].options.tabstop)
call assert_equal('vim', l[0].variables.editor)
call assert_notequal(-1, index(l[0].windows, bufwinid('%')))
--- 17,23 ----
set tabstop&vim
let b:editor = 'vim'
let l = getbufinfo('%')
! call assert_equal(bufnr('%'), l[0].bufnr)
call assert_equal(8, l[0].options.tabstop)
call assert_equal('vim', l[0].variables.editor)
call assert_notequal(-1, index(l[0].windows, bufwinid('%')))
***************
*** 46,70 ****
tabfirst
let winlist = getwininfo()
call assert_equal(5, len(winlist))
! call assert_equal(winbufnr(2), winlist[1].bufnum)
call assert_equal(winheight(2), winlist[1].height)
! call assert_equal(1, winlist[2].nr)
if has('signs')
call assert_equal('auto', winlist[0].options.signcolumn)
endif
! call assert_equal(2, winlist[3].tpnr)
call assert_equal('green', winlist[2].variables.signal)
call assert_equal(winwidth(1), winlist[0].width)
call assert_equal(w4_id, winlist[3].winid)
let winfo = getwininfo(w5_id)[0]
! call assert_equal(2, winfo.tpnr)
call assert_equal([], getwininfo(3))
call settabvar(1, 'space', 'build')
let tablist = gettabinfo()
call assert_equal(2, len(tablist))
call assert_equal(3, len(tablist[1].windows))
! call assert_equal(2, tablist[1].nr)
call assert_equal('build', tablist[0].variables.space)
call assert_equal(w2_id, tablist[0].windows[0])
call assert_equal([], gettabinfo(3))
--- 46,70 ----
tabfirst
let winlist = getwininfo()
call assert_equal(5, len(winlist))
! call assert_equal(winbufnr(2), winlist[1].bufnr)
call assert_equal(winheight(2), winlist[1].height)
! call assert_equal(1, winlist[2].winnr)
if has('signs')
call assert_equal('auto', winlist[0].options.signcolumn)
endif
! call assert_equal(2, winlist[3].tabnr)
call assert_equal('green', winlist[2].variables.signal)
call assert_equal(winwidth(1), winlist[0].width)
call assert_equal(w4_id, winlist[3].winid)
let winfo = getwininfo(w5_id)[0]
! call assert_equal(2, winfo.tabnr)
call assert_equal([], getwininfo(3))
call settabvar(1, 'space', 'build')
let tablist = gettabinfo()
call assert_equal(2, len(tablist))
call assert_equal(3, len(tablist[1].windows))
! call assert_equal(2, tablist[1].tabnr)
call assert_equal('build', tablist[0].variables.space)
call assert_equal(w2_id, tablist[0].windows[0])
call assert_equal([], gettabinfo(3))
*** ../vim-7.4.2225/src/version.c 2016-08-17 22:29:06.158531366 +0200
--- src/version.c 2016-08-18 20:54:42.569387273 +0200
***************
*** 765,766 ****
--- 765,768 ----
{ /* Add new patch number below this line */
+ /**/
+ 2226,
/**/
--
Give a man a computer program and you give him a headache,
but teach him to program computers and you give him the power
to create headaches for others for the rest of his life...
R. B. Forest
/// Bram Moolenaar -- [email protected] -- 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 ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.