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. --- test/functional/ui/tabline_spec.lua | 39 +++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'test') diff --git a/test/functional/ui/tabline_spec.lua b/test/functional/ui/tabline_spec.lua index 4c6fd8fbda..6d212823eb 100644 --- a/test/functional/ui/tabline_spec.lua +++ b/test/functional/ui/tabline_spec.lua @@ -214,4 +214,43 @@ describe('tabline', function() api.nvim_input_mouse('middle', 'press', '', 0, 0, 1) eq({ 1, 1 }, api.nvim_eval('[tabpagenr(), tabpagenr("$")]')) end) + + it('does not show floats with focusable=false', function() + screen:set_default_attr_ids({ + [1] = { background = Screen.colors.Plum1 }, + [2] = { underline = true, background = Screen.colors.LightGrey }, + [3] = { bold = true }, + [4] = { reverse = true }, + [5] = { bold = true, foreground = Screen.colors.Blue1 }, + [6] = { foreground = Screen.colors.Fuchsia, bold = true }, + [7] = { foreground = Screen.colors.SeaGreen, bold = true }, + }) + command('tabnew') + api.nvim_open_win(0, false, { + focusable = false, + relative = 'editor', + height = 1, + width = 1, + row = 0, + col = 0, + }) + screen:expect { + grid = [[ + {1: }{2:[No Name] }{3: [No Name] }{4: }{2:X}| + ^ | + {5:~ }|*2 + | + ]], + } + command('tabs') + screen:expect { + grid = [[ + {6:Tab page 1} | + # [No Name] | + {6:Tab page 2} | + > [No Name] | + {7:Press ENTER or type command to continue}^ | + ]], + } + end) end) -- cgit