commit ad438b6b14afec61821e21705f9e7ac0651ab9cb
parent 310d01d8faa58da570a7f50c8e0bf2a9940a5139
Author: benarcher2691 <ben.archer2691@gmail.com>
Date: Tue, 2 Dec 2025 05:57:56 +0100
fix(ui): exclude hidden windows from tabline window count #36779
Problem: When `vim._extui` is enabled, the default tabline shows an
incorrect window count (e.g., "2" when only 1 window is visible). This
happens because the extui pager window has `focusable=true` (needed for
user interaction) but `hide=true` (not visible by default).
Solution: Modify the window counting logic in `statusline.c` and
`ex_docmd.c:ex_tabs()` to also exclude hidden windows
(`wp->w_config.hide`), not just non-focusable windows.
Also updates test expectations in `cmdline2_spec.lua` which previously
expected the incorrect window count "2" when extui was enabled. The test
now correctly expects no window count indicator when only 1 visible
window exists.
Fixes #36759
Diffstat:
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
@@ -5613,7 +5613,7 @@ static void ex_tabs(exarg_T *eap)
FOR_ALL_WINDOWS_IN_TAB(wp, tp) {
if (got_int) {
break;
- } else if (!wp->w_config.focusable) {
+ } else if (!wp->w_config.focusable || wp->w_config.hide) {
continue;
}
diff --git a/src/nvim/statusline.c b/src/nvim/statusline.c
@@ -710,7 +710,7 @@ void draw_tabline(void)
bool modified = false;
for (wincount = 0; wp != NULL; wp = wp->w_next, wincount++) {
- if (!wp->w_config.focusable) {
+ if (!wp->w_config.focusable || wp->w_config.hide) {
wincount--;
} else if (bufIsChanged(wp->w_buffer)) {
modified = true;
diff --git a/test/functional/ui/cmdline2_spec.lua b/test/functional/ui/cmdline2_spec.lua
@@ -23,7 +23,7 @@ describe('cmdline2', function()
exec('tabnew | tabprev')
feed(':set ch=0')
screen:expect([[
- {5: }{100:2}{5: [No Name] }{24: [No Name] }{2: }{24:X}|
+ {5: [No Name] }{24: [No Name] }{2: }{24:X}|
|
{1:~ }|*11
{16::}{15:set} {16:ch}{15:=}0^ |
@@ -31,14 +31,14 @@ describe('cmdline2', function()
feed('<CR>')
exec('tabnext')
screen:expect([[
- {24: [No Name] }{5: }{100:2}{5: [No Name] }{2: }{24:X}|
+ {24: [No Name] }{5: [No Name] }{2: }{24:X}|
^ |
{1:~ }|*11
{16::}{15:set} {16:ch}{15:=}0 |
]])
exec('tabnext')
screen:expect([[
- {5: }{100:2}{5: [No Name] }{24: [No Name] }{2: }{24:X}|
+ {5: [No Name] }{24: [No Name] }{2: }{24:X}|
^ |
{1:~ }|*12
]])