From ca41148506c81285752877f06d77bfc7dee25d94 Mon Sep 17 00:00:00 2001 From: h-east Date: Sun, 30 Nov 2025 21:56:19 +0900 Subject: [PATCH] Add `status_height` to the dict items returned by `getwininfo()` --- runtime/doc/builtin.txt | 9 +++++---- src/evalwindow.c | 1 + src/testdir/test_bufwintabinfo.vim | 22 ++++++++++++++++++++++ 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 90f873e1d2276..998e417274520 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -5343,9 +5343,13 @@ getwininfo([{winid}]) *getwininfo()* {only with the +quickfix feature} quickfix 1 if quickfix or location list window {only with the +quickfix feature} + status_height status lines height (0 or 1) + tabnr tab page number terminal 1 if a terminal window {only with the +terminal feature} - tabnr tab page number + textoff number of columns occupied by any + 'foldcolumn', 'signcolumn' and line + number in front of the text topline first displayed buffer line variables a reference to the dictionary with window-local variables @@ -5354,9 +5358,6 @@ getwininfo([{winid}]) *getwininfo()* otherwise wincol leftmost screen column of the window; "col" from |win_screenpos()| - textoff number of columns occupied by any - 'foldcolumn', 'signcolumn' and line - number in front of the text winid |window-ID| winnr window number winrow topmost screen line of the window; diff --git a/src/evalwindow.c b/src/evalwindow.c index 05c3d1d9bbf57..9a4efaa8c3f3e 100644 --- a/src/evalwindow.c +++ b/src/evalwindow.c @@ -416,6 +416,7 @@ get_win_info(win_T *wp, short tpnr, short winnr) dict_add_number(dict, "winnr", winnr); dict_add_number(dict, "winid", wp->w_id); dict_add_number(dict, "height", wp->w_height); + dict_add_number(dict, "status_height", wp->w_status_height); dict_add_number(dict, "winrow", wp->w_winrow + 1); dict_add_number(dict, "topline", wp->w_topline); dict_add_number(dict, "botline", wp->w_botline - 1); diff --git a/src/testdir/test_bufwintabinfo.vim b/src/testdir/test_bufwintabinfo.vim index f7318ff55ab8d..96dc060233094 100644 --- a/src/testdir/test_bufwintabinfo.vim +++ b/src/testdir/test_bufwintabinfo.vim @@ -204,4 +204,26 @@ func Test_getwininfo_au() bwipe! 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