From ad438b6b14afec61821e21705f9e7ac0651ab9cb Mon Sep 17 00:00:00 2001 From: benarcher2691 Date: Tue, 2 Dec 2025 05:57:56 +0100 Subject: [PATCH] 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 --- src/nvim/ex_docmd.c | 2 +- src/nvim/statusline.c | 2 +- test/functional/ui/cmdline2_spec.lua | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index cfbd3e9a8e..fc6d188f8a 100644 --- 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 index 5b98954875..19341b05c8 100644 --- 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 index 928c5bfda0..ce3187f4f6 100644 --- 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('') 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 ]])