mirror of
https://github.com/neovim/neovim.git
synced 2026-07-18 07:01:19 +00:00
vim-patch:9.1.1944: getwininfo() does not return if statusline is visible (#36828)
Problem: gewininfo() does not return if statusline is visible
Solution: Add status_height to the dict items returned by
getwininfo() (Hirohito Higashi)
closes: vim/vim#18841
a04ab5f04c
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
This commit is contained in:
@@ -4445,8 +4445,12 @@ getwininfo([{winid}]) *getwininfo()*
|
|||||||
'wrap' is off
|
'wrap' is off
|
||||||
loclist 1 if showing a location list
|
loclist 1 if showing a location list
|
||||||
quickfix 1 if quickfix or location list window
|
quickfix 1 if quickfix or location list window
|
||||||
terminal 1 if a terminal window
|
status_height status lines height (0 or 1)
|
||||||
tabnr tab page number
|
tabnr tab page number
|
||||||
|
terminal 1 if a terminal window
|
||||||
|
textoff number of columns occupied by any
|
||||||
|
'foldcolumn', 'signcolumn' and line
|
||||||
|
number in front of the text
|
||||||
topline first displayed buffer line
|
topline first displayed buffer line
|
||||||
variables a reference to the dictionary with
|
variables a reference to the dictionary with
|
||||||
window-local variables
|
window-local variables
|
||||||
@@ -4455,9 +4459,6 @@ 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;
|
||||||
|
|||||||
9
runtime/lua/vim/_meta/vimfn.lua
generated
9
runtime/lua/vim/_meta/vimfn.lua
generated
@@ -4012,8 +4012,12 @@ function vim.fn.gettext(text) end
|
|||||||
--- 'wrap' is off
|
--- 'wrap' is off
|
||||||
--- loclist 1 if showing a location list
|
--- loclist 1 if showing a location list
|
||||||
--- quickfix 1 if quickfix or location list window
|
--- quickfix 1 if quickfix or location list window
|
||||||
--- terminal 1 if a terminal window
|
--- status_height status lines height (0 or 1)
|
||||||
--- tabnr tab page number
|
--- tabnr tab page number
|
||||||
|
--- terminal 1 if a terminal window
|
||||||
|
--- textoff number of columns occupied by any
|
||||||
|
--- 'foldcolumn', 'signcolumn' and line
|
||||||
|
--- number in front of the text
|
||||||
--- topline first displayed buffer line
|
--- topline first displayed buffer line
|
||||||
--- variables a reference to the dictionary with
|
--- variables a reference to the dictionary with
|
||||||
--- window-local variables
|
--- window-local variables
|
||||||
@@ -4022,9 +4026,6 @@ function vim.fn.gettext(text) end
|
|||||||
--- 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;
|
||||||
|
|||||||
@@ -4961,8 +4961,12 @@ M.funcs = {
|
|||||||
'wrap' is off
|
'wrap' is off
|
||||||
loclist 1 if showing a location list
|
loclist 1 if showing a location list
|
||||||
quickfix 1 if quickfix or location list window
|
quickfix 1 if quickfix or location list window
|
||||||
terminal 1 if a terminal window
|
status_height status lines height (0 or 1)
|
||||||
tabnr tab page number
|
tabnr tab page number
|
||||||
|
terminal 1 if a terminal window
|
||||||
|
textoff number of columns occupied by any
|
||||||
|
'foldcolumn', 'signcolumn' and line
|
||||||
|
number in front of the text
|
||||||
topline first displayed buffer line
|
topline first displayed buffer line
|
||||||
variables a reference to the dictionary with
|
variables a reference to the dictionary with
|
||||||
window-local variables
|
window-local variables
|
||||||
@@ -4971,9 +4975,6 @@ M.funcs = {
|
|||||||
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;
|
||||||
|
|||||||
@@ -333,6 +333,7 @@ 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_view_height);
|
tv_dict_add_nr(dict, S_LEN("height"), wp->w_view_height);
|
||||||
|
tv_dict_add_nr(dict, S_LEN("status_height"), wp->w_status_height);
|
||||||
tv_dict_add_nr(dict, S_LEN("winrow"), wp->w_winrow + 1);
|
tv_dict_add_nr(dict, S_LEN("winrow"), wp->w_winrow + 1);
|
||||||
tv_dict_add_nr(dict, S_LEN("topline"), wp->w_topline);
|
tv_dict_add_nr(dict, S_LEN("topline"), wp->w_topline);
|
||||||
tv_dict_add_nr(dict, S_LEN("botline"), wp->w_botline - 1);
|
tv_dict_add_nr(dict, S_LEN("botline"), wp->w_botline - 1);
|
||||||
|
|||||||
@@ -201,4 +201,26 @@ func Test_getwininfo_au()
|
|||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_getwininfo_status_height()
|
||||||
|
set laststatus=0
|
||||||
|
vsplit
|
||||||
|
let info = getwininfo(win_getid())[0]
|
||||||
|
call assert_equal(0, info.status_height)
|
||||||
|
|
||||||
|
set laststatus=2
|
||||||
|
let info = getwininfo(win_getid())[0]
|
||||||
|
call assert_equal(1, info.status_height)
|
||||||
|
|
||||||
|
set laststatus=1
|
||||||
|
only
|
||||||
|
let info = getwininfo(win_getid())[0]
|
||||||
|
call assert_equal(0, info.status_height)
|
||||||
|
vsplit
|
||||||
|
let info = getwininfo(win_getid())[0]
|
||||||
|
call assert_equal(1, info.status_height)
|
||||||
|
|
||||||
|
set laststatus&vim
|
||||||
|
bwipe!
|
||||||
|
endfunc
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
|||||||
Reference in New Issue
Block a user