Skip to content

Commit b6959a8

Browse files
committed
patch 8.1.0184: not easy to figure out the window layout
Problem: Not easy to figure out the window layout. Solution: Add "wincol" and "winrow" to what getwininfo() returns.
1 parent 1741367 commit b6959a8

File tree

4 files changed

+25
-2
lines changed

4 files changed

+25
-2
lines changed

runtime/doc/eval.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4994,8 +4994,10 @@ getwininfo([{winid}]) *getwininfo()*
49944994
variables a reference to the dictionary with
49954995
window-local variables
49964996
width window width
4997+
wincol leftmost screen column of the window
49974998
winid |window-ID|
49984999
winnr window number
5000+
winrow topmost screen column of the window
49995001

50005002
To obtain all window-local variables use: >
50015003
gettabwinvar({tabnr}, {winnr}, '&')

src/evalfunc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5648,10 +5648,12 @@ get_win_info(win_T *wp, short tpnr, short winnr)
56485648
dict_add_number(dict, "winnr", winnr);
56495649
dict_add_number(dict, "winid", wp->w_id);
56505650
dict_add_number(dict, "height", wp->w_height);
5651+
dict_add_number(dict, "winrow", wp->w_winrow);
56515652
#ifdef FEAT_MENU
56525653
dict_add_number(dict, "winbar", wp->w_winbar_height);
56535654
#endif
56545655
dict_add_number(dict, "width", wp->w_width);
5656+
dict_add_number(dict, "wincol", wp->w_wincol);
56555657
dict_add_number(dict, "bufnr", wp->w_buffer->b_fnum);
56565658

56575659
#ifdef FEAT_TERMINAL

src/testdir/test_bufwintabinfo.vim

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,34 @@ function Test_getbufwintabinfo()
4646
let w2_id = win_getid()
4747
tabnew | let w3_id = win_getid()
4848
new | let w4_id = win_getid()
49-
new | let w5_id = win_getid()
49+
vert new | let w5_id = win_getid()
5050
call setwinvar(0, 'signal', 'green')
5151
tabfirst
5252
let winlist = getwininfo()
5353
call assert_equal(5, len(winlist))
54+
call assert_equal(winwidth(1), winlist[0].width)
55+
call assert_equal(0, winlist[0].wincol)
56+
call assert_equal(1, winlist[0].winrow) " tabline adds one
57+
5458
call assert_equal(winbufnr(2), winlist[1].bufnr)
5559
call assert_equal(winheight(2), winlist[1].height)
60+
call assert_equal(0, winlist[1].wincol)
61+
call assert_equal(winheight(1) + 2, winlist[1].winrow)
62+
5663
call assert_equal(1, winlist[2].winnr)
64+
call assert_equal(1, winlist[2].winrow)
65+
call assert_equal(0, winlist[2].wincol)
66+
67+
call assert_equal(winlist[2].width + 1, winlist[3].wincol)
68+
call assert_equal(0, winlist[4].wincol)
69+
70+
call assert_equal(1, winlist[0].tabnr)
71+
call assert_equal(1, winlist[1].tabnr)
72+
call assert_equal(2, winlist[2].tabnr)
5773
call assert_equal(2, winlist[3].tabnr)
74+
call assert_equal(2, winlist[4].tabnr)
75+
5876
call assert_equal('green', winlist[2].variables.signal)
59-
call assert_equal(winwidth(1), winlist[0].width)
6077
call assert_equal(w4_id, winlist[3].winid)
6178
let winfo = getwininfo(w5_id)[0]
6279
call assert_equal(2, winfo.tabnr)

src/version.c

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

790790
static int included_patches[] =
791791
{ /* Add new patch number below this line */
792+
/**/
793+
184,
792794
/**/
793795
183,
794796
/**/

0 commit comments

Comments
 (0)