1
0
forked from aniani/vim

patch 9.1.0888: leftcol property not available in getwininfo()

Problem:  leftcol property not available in getwininfo()
Solution: add leftcol property property (glepnir)

closes: #16119

Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
glepnir
2024-11-25 19:39:04 +01:00
committed by Christian Brabandt
parent ea49002aca
commit 0a850673e3
4 changed files with 18 additions and 1 deletions

View File

@@ -1,4 +1,4 @@
*builtin.txt* For Vim version 9.1. Last change: 2024 Nov 18 *builtin.txt* For Vim version 9.1. Last change: 2024 Nov 26
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@@ -5086,6 +5086,8 @@ getwininfo([{winid}]) *getwininfo()*
botline last complete displayed buffer line botline last complete displayed buffer line
bufnr number of buffer in the window bufnr number of buffer in the window
height window height (excluding winbar) height window height (excluding winbar)
leftcol first column displayed; only used when
'wrap' is off
loclist 1 if showing a location list loclist 1 if showing a location list
{only with the +quickfix feature} {only with the +quickfix feature}
quickfix 1 if quickfix or location list window quickfix 1 if quickfix or location list window

View File

@@ -426,6 +426,7 @@ get_win_info(win_T *wp, short tpnr, short winnr)
dict_add_number(dict, "wincol", wp->w_wincol + 1); dict_add_number(dict, "wincol", wp->w_wincol + 1);
dict_add_number(dict, "textoff", win_col_off(wp)); dict_add_number(dict, "textoff", win_col_off(wp));
dict_add_number(dict, "bufnr", wp->w_buffer->b_fnum); dict_add_number(dict, "bufnr", wp->w_buffer->b_fnum);
dict_add_number(dict, "leftcol", wp->w_leftcol);
#ifdef FEAT_TERMINAL #ifdef FEAT_TERMINAL
dict_add_number(dict, "terminal", bt_terminal(wp->w_buffer)); dict_add_number(dict, "terminal", bt_terminal(wp->w_buffer));

View File

@@ -115,6 +115,18 @@ func Test_getbufwintabinfo()
wincmd t | only wincmd t | only
endfunc endfunc
function Test_get_wininfo_leftcol()
set nowrap
set winwidth=10
vsp
call setline(1, ['abcdefghijklmnopqrstuvwxyz'])
norm! 5zl
call assert_equal(5, getwininfo()[0].leftcol)
bwipe!
set wrap&
set winwidth&
endfunc
function Test_get_buf_options() function Test_get_buf_options()
let opts = bufnr()->getbufvar('&') let opts = bufnr()->getbufvar('&')
call assert_equal(v:t_dict, type(opts)) call assert_equal(v:t_dict, type(opts))

View File

@@ -704,6 +704,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
888,
/**/ /**/
887, 887,
/**/ /**/