From 9f0b4d0000c52d23a2dfe0092fe2f6f1714e6ea5 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Mon, 29 Jan 2024 18:04:50 +0100 Subject: Don't omit section headers when filtering the keybindings menu --- pkg/gui/context/menu_context.go | 7 ------- pkg/integration/tests/filter_and_search/filter_menu.go | 1 + .../filter_and_search/filter_menu_cancel_filter_with_escape.go | 1 + 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/pkg/gui/context/menu_context.go b/pkg/gui/context/menu_context.go index 32d6d7610..7f8656fe7 100644 --- a/pkg/gui/context/menu_context.go +++ b/pkg/gui/context/menu_context.go @@ -112,13 +112,6 @@ func (self *MenuViewModel) GetDisplayStrings(_ int, _ int) [][]string { } func (self *MenuViewModel) GetNonModelItems() []*NonModelItem { - // Don't display section headers when we are filtering. The reason is that - // filtering changes the order of the items (they are sorted by best match), - // so all the sections would be messed up. - if self.FilteredListViewModel.IsFiltering() { - return []*NonModelItem{} - } - result := []*NonModelItem{} menuItems := self.FilteredListViewModel.GetItems() var prevSection *types.MenuSection = nil diff --git a/pkg/integration/tests/filter_and_search/filter_menu.go b/pkg/integration/tests/filter_and_search/filter_menu.go index 70c8244f8..59c47fb71 100644 --- a/pkg/integration/tests/filter_and_search/filter_menu.go +++ b/pkg/integration/tests/filter_and_search/filter_menu.go @@ -26,6 +26,7 @@ var FilterMenu = NewIntegrationTest(NewIntegrationTestArgs{ Filter("Ignore"). Lines( // menu has filtered down to the one item that matches the filter + Contains(`--- Local ---`), Contains(`Ignore`).IsSelected(), ). Confirm() diff --git a/pkg/integration/tests/filter_and_search/filter_menu_cancel_filter_with_escape.go b/pkg/integration/tests/filter_and_search/filter_menu_cancel_filter_with_escape.go index 6fb7166ca..daf55fd0d 100644 --- a/pkg/integration/tests/filter_and_search/filter_menu_cancel_filter_with_escape.go +++ b/pkg/integration/tests/filter_and_search/filter_menu_cancel_filter_with_escape.go @@ -20,6 +20,7 @@ var FilterMenuCancelFilterWithEscape = NewIntegrationTest(NewIntegrationTestArgs Filter("Ignore"). Lines( // menu has filtered down to the one item that matches the filter + Contains(`--- Local ---`), Contains(`Ignore`).IsSelected(), ) -- cgit v1.2.3