mirror of
https://github.com/neovim/neovim.git
synced 2025-12-12 17:42:37 +00:00
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:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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
|
||||||
]])
|
]])
|
||||||
|
|||||||
Reference in New Issue
Block a user