mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-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.
b6959a8e06
This commit is contained in:
parent
b89c08901c
commit
2036d04284
@ -4472,8 +4472,10 @@ getwininfo([{winid}]) *getwininfo()*
|
|||||||
variables a reference to the dictionary with
|
variables a reference to the dictionary with
|
||||||
window-local variables
|
window-local variables
|
||||||
width window width
|
width window width
|
||||||
|
wincol leftmost screen column of the window
|
||||||
winid |window-ID|
|
winid |window-ID|
|
||||||
winnr window number
|
winnr window number
|
||||||
|
winrow topmost screen column of the window
|
||||||
|
|
||||||
To obtain all window-local variables use: >
|
To obtain all window-local variables use: >
|
||||||
gettabwinvar({tabnr}, {winnr}, '&')
|
gettabwinvar({tabnr}, {winnr}, '&')
|
||||||
|
@ -10262,8 +10262,10 @@ static dict_T *get_win_info(win_T *wp, int16_t tpnr, int16_t winnr)
|
|||||||
tv_dict_add_nr(dict, S_LEN("winnr"), winnr);
|
tv_dict_add_nr(dict, S_LEN("winnr"), winnr);
|
||||||
tv_dict_add_nr(dict, S_LEN("winid"), wp->handle);
|
tv_dict_add_nr(dict, S_LEN("winid"), wp->handle);
|
||||||
tv_dict_add_nr(dict, S_LEN("height"), wp->w_height);
|
tv_dict_add_nr(dict, S_LEN("height"), wp->w_height);
|
||||||
|
tv_dict_add_nr(dict, S_LEN("winrow"), wp->w_winrow);
|
||||||
tv_dict_add_nr(dict, S_LEN("width"), wp->w_width);
|
tv_dict_add_nr(dict, S_LEN("width"), wp->w_width);
|
||||||
tv_dict_add_nr(dict, S_LEN("bufnr"), wp->w_buffer->b_fnum);
|
tv_dict_add_nr(dict, S_LEN("bufnr"), wp->w_buffer->b_fnum);
|
||||||
|
tv_dict_add_nr(dict, S_LEN("wincol"), wp->w_wincol);
|
||||||
|
|
||||||
tv_dict_add_nr(dict, S_LEN("quickfix"), bt_quickfix(wp->w_buffer));
|
tv_dict_add_nr(dict, S_LEN("quickfix"), bt_quickfix(wp->w_buffer));
|
||||||
tv_dict_add_nr(dict, S_LEN("loclist"),
|
tv_dict_add_nr(dict, S_LEN("loclist"),
|
||||||
|
@ -39,17 +39,34 @@ function Test_getbufwintabinfo()
|
|||||||
let w2_id = win_getid()
|
let w2_id = win_getid()
|
||||||
tabnew | let w3_id = win_getid()
|
tabnew | let w3_id = win_getid()
|
||||||
new | let w4_id = win_getid()
|
new | let w4_id = win_getid()
|
||||||
new | let w5_id = win_getid()
|
vert new | let w5_id = win_getid()
|
||||||
call setwinvar(0, 'signal', 'green')
|
call setwinvar(0, 'signal', 'green')
|
||||||
tabfirst
|
tabfirst
|
||||||
let winlist = getwininfo()
|
let winlist = getwininfo()
|
||||||
call assert_equal(5, len(winlist))
|
call assert_equal(5, len(winlist))
|
||||||
|
call assert_equal(winwidth(1), winlist[0].width)
|
||||||
|
call assert_equal(0, winlist[0].wincol)
|
||||||
|
call assert_equal(1, winlist[0].winrow) " tabline adds one
|
||||||
|
|
||||||
call assert_equal(winbufnr(2), winlist[1].bufnr)
|
call assert_equal(winbufnr(2), winlist[1].bufnr)
|
||||||
call assert_equal(winheight(2), winlist[1].height)
|
call assert_equal(winheight(2), winlist[1].height)
|
||||||
|
call assert_equal(0, winlist[1].wincol)
|
||||||
|
call assert_equal(winheight(1) + 2, winlist[1].winrow)
|
||||||
|
|
||||||
call assert_equal(1, winlist[2].winnr)
|
call assert_equal(1, winlist[2].winnr)
|
||||||
|
call assert_equal(1, winlist[2].winrow)
|
||||||
|
call assert_equal(0, winlist[2].wincol)
|
||||||
|
|
||||||
|
call assert_equal(winlist[2].width + 1, winlist[3].wincol)
|
||||||
|
call assert_equal(0, winlist[4].wincol)
|
||||||
|
|
||||||
|
call assert_equal(1, winlist[0].tabnr)
|
||||||
|
call assert_equal(1, winlist[1].tabnr)
|
||||||
|
call assert_equal(2, winlist[2].tabnr)
|
||||||
call assert_equal(2, winlist[3].tabnr)
|
call assert_equal(2, winlist[3].tabnr)
|
||||||
|
call assert_equal(2, winlist[4].tabnr)
|
||||||
|
|
||||||
call assert_equal('green', winlist[2].variables.signal)
|
call assert_equal('green', winlist[2].variables.signal)
|
||||||
call assert_equal(winwidth(1), winlist[0].width)
|
|
||||||
call assert_equal(w4_id, winlist[3].winid)
|
call assert_equal(w4_id, winlist[3].winid)
|
||||||
let winfo = getwininfo(w5_id)[0]
|
let winfo = getwininfo(w5_id)[0]
|
||||||
call assert_equal(2, winfo.tabnr)
|
call assert_equal(2, winfo.tabnr)
|
||||||
|
Loading…
Reference in New Issue
Block a user