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
This commit is contained in:
benarcher2691
2025-12-02 05:57:56 +01:00
committed by GitHub
parent 310d01d8fa
commit ad438b6b14
3 changed files with 5 additions and 5 deletions

View File

@@ -5613,7 +5613,7 @@ static void ex_tabs(exarg_T *eap)
FOR_ALL_WINDOWS_IN_TAB(wp, tp) { FOR_ALL_WINDOWS_IN_TAB(wp, tp) {
if (got_int) { if (got_int) {
break; break;
} else if (!wp->w_config.focusable) { } else if (!wp->w_config.focusable || wp->w_config.hide) {
continue; continue;
} }

View File

@@ -710,7 +710,7 @@ void draw_tabline(void)
bool modified = false; bool modified = false;
for (wincount = 0; wp != NULL; wp = wp->w_next, wincount++) { 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--; wincount--;
} else if (bufIsChanged(wp->w_buffer)) { } else if (bufIsChanged(wp->w_buffer)) {
modified = true; modified = true;

View File

@@ -23,7 +23,7 @@ describe('cmdline2', function()
exec('tabnew | tabprev') exec('tabnew | tabprev')
feed(':set ch=0') feed(':set ch=0')
screen:expect([[ 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 {1:~ }|*11
{16::}{15:set} {16:ch}{15:=}0^ | {16::}{15:set} {16:ch}{15:=}0^ |
@@ -31,14 +31,14 @@ describe('cmdline2', function()
feed('<CR>') feed('<CR>')
exec('tabnext') exec('tabnext')
screen:expect([[ 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 {1:~ }|*11
{16::}{15:set} {16:ch}{15:=}0 | {16::}{15:set} {16:ch}{15:=}0 |
]]) ]])
exec('tabnext') exec('tabnext')
screen:expect([[ 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 {1:~ }|*12
]]) ]])