From f85bc41c800d7f5c0256f29aa347a53600a7c8d5 Mon Sep 17 00:00:00 2001 From: luukvbaal Date: Sun, 17 Nov 2024 00:32:36 +0100 Subject: feat(ui): don't show unfocusable windows in :tabs, 'tabline' #27984 Problem: Floating windows with focusable set to false can reasonably be expected to be UI elements but are listed in some outputs that should contain only regular windows. Solution: Hide unfocusable floating windows from the default tabline and :tabs. --- src/nvim/api/win_config.c | 2 +- src/nvim/ex_docmd.c | 2 ++ src/nvim/statusline.c | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src/nvim') diff --git a/src/nvim/api/win_config.c b/src/nvim/api/win_config.c index 16811e0cd9..6f5a9a90c0 100644 --- a/src/nvim/api/win_config.c +++ b/src/nvim/api/win_config.c @@ -130,7 +130,7 @@ /// - focusable: Enable focus by user actions (wincmds, mouse events). /// Defaults to true. Non-focusable windows can be entered by /// |nvim_set_current_win()|, or, when the `mouse` field is set to true, -/// by mouse events. +/// by mouse events. See |focusable|. /// - mouse: Specify how this window interacts with mouse events. /// Defaults to `focusable` value. /// - If false, mouse events pass through this window. diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index e8b9470391..f5ecedf827 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -5507,6 +5507,8 @@ static void ex_tabs(exarg_T *eap) FOR_ALL_WINDOWS_IN_TAB(wp, tp) { if (got_int) { break; + } else if (!wp->w_config.focusable) { + continue; } msg_putchar('\n'); diff --git a/src/nvim/statusline.c b/src/nvim/statusline.c index ba64633df7..4e78067d46 100644 --- a/src/nvim/statusline.c +++ b/src/nvim/statusline.c @@ -760,7 +760,9 @@ void draw_tabline(void) bool modified = false; for (wincount = 0; wp != NULL; wp = wp->w_next, wincount++) { - if (bufIsChanged(wp->w_buffer)) { + if (!wp->w_config.focusable) { + wincount--; + } else if (bufIsChanged(wp->w_buffer)) { modified = true; } } -- cgit