diff options
author | James McCoy <jamessan@jamessan.com> | 2016-11-15 16:46:11 -0500 |
---|---|---|
committer | James McCoy <jamessan@jamessan.com> | 2016-12-28 14:57:39 -0500 |
commit | c4c894b2fada371c424e55d26174110b9069b5f8 (patch) | |
tree | 04398ea516a3b6db1addaf4fbc68f176301d9462 | |
parent | 486e968bb6bdfb49d17305d6f7747408eda95926 (diff) | |
download | rneovim-c4c894b2fada371c424e55d26174110b9069b5f8.tar.gz rneovim-c4c894b2fada371c424e55d26174110b9069b5f8.tar.bz2 rneovim-c4c894b2fada371c424e55d26174110b9069b5f8.zip |
vim-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)
https://github.com/vim/vim/commit/339288377072f66ec88e21903e75a82d23ffbf4f
-rw-r--r-- | runtime/doc/eval.txt | 2 | ||||
-rw-r--r-- | src/nvim/eval.c | 10 | ||||
-rw-r--r-- | src/nvim/testdir/test_bufwintabinfo.vim | 12 | ||||
-rw-r--r-- | src/nvim/version.c | 2 |
4 files changed, 13 insertions, 13 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 3bf13dfc34..d97c10ee84 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -3617,6 +3617,7 @@ getbufinfo([{dict}]) 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. @@ -3624,7 +3625,6 @@ getbufinfo([{dict}]) 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 diff --git a/src/nvim/eval.c b/src/nvim/eval.c index a59bfca2a5..6dee5ed336 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -9868,7 +9868,7 @@ static dict_T *get_buffer_info(buf_T *buf) { dict_T *dict = dict_alloc(); - dict_add_nr_str(dict, "nr", buf->b_fnum, 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); @@ -10798,7 +10798,7 @@ static dict_T *get_tabpage_info(tabpage_T *tp, int tp_idx) { dict_T *dict = dict_alloc(); - dict_add_nr_str(dict, "nr", tp_idx, NULL); + dict_add_nr_str(dict, "tabnr", tp_idx, NULL); list_T *l = list_alloc(); FOR_ALL_WINDOWS_IN_TAB(wp, tp) { @@ -10898,12 +10898,12 @@ static dict_T *get_win_info(win_T *wp, short tpnr, short winnr) { dict_T *dict = dict_alloc(); - dict_add_nr_str(dict, "tpnr", tpnr, NULL); - dict_add_nr_str(dict, "nr", winnr, NULL); + dict_add_nr_str(dict, "tabnr", tpnr, NULL); + dict_add_nr_str(dict, "winnr", winnr, NULL); dict_add_nr_str(dict, "winid", wp->handle, 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); + dict_add_nr_str(dict, "bufnr", wp->w_buffer->b_fnum, NULL); dict_add_nr_str(dict, "quickfix", bt_quickfix(wp->w_buffer), NULL); dict_add_nr_str(dict, "loclist", diff --git a/src/nvim/testdir/test_bufwintabinfo.vim b/src/nvim/testdir/test_bufwintabinfo.vim index fa9d97bc85..42c016621f 100644 --- a/src/nvim/testdir/test_bufwintabinfo.vim +++ b/src/nvim/testdir/test_bufwintabinfo.vim @@ -17,7 +17,7 @@ function Test_getbufwintabinfo() set tabstop&vim let b:editor = 'vim' let l = getbufinfo('%') - call assert_equal(bufnr('%'), l[0].nr) + 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,23 +46,23 @@ function Test_getbufwintabinfo() tabfirst let winlist = getwininfo() call assert_equal(5, len(winlist)) - call assert_equal(winbufnr(2), winlist[1].bufnum) + call assert_equal(winbufnr(2), winlist[1].bufnr) call assert_equal(winheight(2), winlist[1].height) - call assert_equal(1, winlist[2].nr) + call assert_equal(1, winlist[2].winnr) call assert_equal('auto', winlist[0].options.signcolumn) - call assert_equal(2, winlist[3].tpnr) + 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.tpnr) + 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].nr) + 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)) diff --git a/src/nvim/version.c b/src/nvim/version.c index 756873f6d8..21fa7253ba 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -214,7 +214,7 @@ static int included_patches[] = { // 2229, // 2228, 2227, - // 2226, + 2226, 2225, // 2224, // 2223, |