vim-patch:8.2.3627: difficult to know where the text starts in a window (#16377)

vim-patch:8.2.3627: difficult to know where the text starts in a window

Problem:    difficult to know where the text starts in a window. (Sergey
            Vlasov)
Solution:   Add the "textoff" entry in the result of getwininfo().
            (closes vim/vim#9163)
cdf5fdb294

Fix indent in Test_getbufwintabinfo().
This commit is contained in:
zeertzjq
2021-11-22 10:10:03 +08:00
committed by GitHub
parent f45b2f313e
commit e05db65d2a
3 changed files with 97 additions and 92 deletions

View File

@@ -5562,6 +5562,9 @@ getwininfo([{winid}]) *getwininfo()*
otherwise otherwise
wincol leftmost screen column of the window; wincol leftmost screen column of the window;
"col" from |win_screenpos()| "col" from |win_screenpos()|
textoff number of columns occupied by any
'foldcolumn', 'signcolumn' and line
number in front of the text
winid |window-ID| winid |window-ID|
winnr window number winnr window number
winrow topmost screen line of the window; winrow topmost screen line of the window;

View File

@@ -6851,7 +6851,7 @@ dict_T *get_win_info(win_T *wp, int16_t tpnr, int16_t winnr)
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 + 1); tv_dict_add_nr(dict, S_LEN("wincol"), wp->w_wincol + 1);
tv_dict_add_nr(dict, S_LEN("textoff"), win_col_off(wp));
tv_dict_add_nr(dict, S_LEN("terminal"), bt_terminal(wp->w_buffer)); tv_dict_add_nr(dict, S_LEN("terminal"), bt_terminal(wp->w_buffer));
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"),

View File

@@ -42,6 +42,7 @@ function Test_getbufwintabinfo()
only only
let w1_id = win_getid() let w1_id = win_getid()
setl foldcolumn=3
new new
let w2_id = win_getid() let w2_id = win_getid()
tabnew | let w3_id = win_getid() tabnew | let w3_id = win_getid()
@@ -60,6 +61,7 @@ function Test_getbufwintabinfo()
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(1, winlist[1].wincol) call assert_equal(1, winlist[1].wincol)
call assert_equal(3, winlist[1].textoff) " foldcolumn
call assert_equal(tablineheight + winheight(1) + 2, winlist[1].winrow) call assert_equal(tablineheight + winheight(1) + 2, winlist[1].winrow)
call assert_equal(1, winlist[2].winnr) call assert_equal(1, winlist[2].winnr)