From bb7e74968bc45c02b1ca646dfab2916513591017 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Tue, 25 Aug 2026 09:49:39 +0200 Subject: [PATCH] Drop the menu-specific wording for the filter prompt The only menu that ever asked for it was the keybindings menu, which now filters as you type and doesn't use the prompt at all. That leaves every filterable context with the same prompt, so the whole hook can go, and with it the two implementations that only existed to satisfy it. Co-authored-by: Claude Opus 5 (1M context) --- pkg/gui/context/filtered_list_view_model.go | 7 ------- pkg/gui/context/menu_context.go | 9 --------- pkg/gui/controllers/helpers/search_helper.go | 4 ++-- pkg/gui/controllers/helpers/window_arrangement_helper.go | 4 ++-- pkg/gui/filetree/commit_file_tree_view_model.go | 5 ----- pkg/gui/filetree/file_tree_view_model.go | 5 ----- pkg/gui/types/context.go | 2 -- 7 files changed, 4 insertions(+), 32 deletions(-) diff --git a/pkg/gui/context/filtered_list_view_model.go b/pkg/gui/context/filtered_list_view_model.go index ce2f8ac36..2c2841964 100644 --- a/pkg/gui/context/filtered_list_view_model.go +++ b/pkg/gui/context/filtered_list_view_model.go @@ -1,7 +1,5 @@ package context -import "github.com/jesseduffield/lazygit/pkg/i18n" - type FilteredListViewModel[T HasID] struct { *FilteredList[T] *ListViewModel[T] @@ -35,8 +33,3 @@ func (self *FilteredListViewModel[T]) ClearFilter() { self.SetSelection(unfilteredIndex) } - -// Default implementation of most filterable contexts. Can be overridden if needed. -func (self *FilteredListViewModel[T]) FilterPrefix(tr *i18n.TranslationSet) string { - return tr.FilterPrefix -} diff --git a/pkg/gui/context/menu_context.go b/pkg/gui/context/menu_context.go index 63439bc67..55a3e5bfa 100644 --- a/pkg/gui/context/menu_context.go +++ b/pkg/gui/context/menu_context.go @@ -8,7 +8,6 @@ import ( "github.com/jesseduffield/lazygit/pkg/gocui" "github.com/jesseduffield/lazygit/pkg/gui/style" "github.com/jesseduffield/lazygit/pkg/gui/types" - "github.com/jesseduffield/lazygit/pkg/i18n" "github.com/jesseduffield/lazygit/pkg/utils" "github.com/samber/lo" ) @@ -323,11 +322,3 @@ func (self *MenuContext) GetInputViewName() string { return self.GetViewName() } - -func (self *MenuContext) FilterPrefix(tr *i18n.TranslationSet) string { - if self.allowFilteringKeybindings { - return tr.FilterPrefixMenu - } - - return self.FilteredListViewModel.FilterPrefix(tr) -} diff --git a/pkg/gui/controllers/helpers/search_helper.go b/pkg/gui/controllers/helpers/search_helper.go index 5de08df6d..96c4c35ba 100644 --- a/pkg/gui/controllers/helpers/search_helper.go +++ b/pkg/gui/controllers/helpers/search_helper.go @@ -36,7 +36,7 @@ func (self *SearchHelper) OpenFilterPrompt(context types.IFilterableContext) { state.Context = context - self.searchPrefixView().SetContent(context.FilterPrefix(self.c.Tr)) + self.searchPrefixView().SetContent(self.c.Tr.FilterPrefix) promptView := self.promptView() promptView.ClearTextArea() self.OnPromptContentChanged("") @@ -70,7 +70,7 @@ func (self *SearchHelper) DisplayFilterStatus(context types.IFilterableContext) state.Context = context searchString := context.GetFilter() - self.searchPrefixView().SetContent(context.FilterPrefix(self.c.Tr)) + self.searchPrefixView().SetContent(self.c.Tr.FilterPrefix) promptView := self.promptView() keybindingConfig := self.c.UserConfig().Keybinding diff --git a/pkg/gui/controllers/helpers/window_arrangement_helper.go b/pkg/gui/controllers/helpers/window_arrangement_helper.go index 90a651809..5379e9c09 100644 --- a/pkg/gui/controllers/helpers/window_arrangement_helper.go +++ b/pkg/gui/controllers/helpers/window_arrangement_helper.go @@ -87,8 +87,8 @@ func (self *WindowArrangementHelper) GetWindowDimensions(informationStr string, repoState := self.c.State().GetRepoState() var searchPrefix string - if filterableContext, ok := repoState.GetSearchState().Context.(types.IFilterableContext); ok { - searchPrefix = filterableContext.FilterPrefix(self.c.Tr) + if _, ok := repoState.GetSearchState().Context.(types.IFilterableContext); ok { + searchPrefix = self.c.Tr.FilterPrefix } else { searchPrefix = self.c.Tr.SearchPrefix } diff --git a/pkg/gui/filetree/commit_file_tree_view_model.go b/pkg/gui/filetree/commit_file_tree_view_model.go index a58f7d93e..a59bcb01a 100644 --- a/pkg/gui/filetree/commit_file_tree_view_model.go +++ b/pkg/gui/filetree/commit_file_tree_view_model.go @@ -7,7 +7,6 @@ import ( "github.com/jesseduffield/lazygit/pkg/common" "github.com/jesseduffield/lazygit/pkg/gui/context/traits" "github.com/jesseduffield/lazygit/pkg/gui/types" - "github.com/jesseduffield/lazygit/pkg/i18n" "github.com/jesseduffield/lazygit/pkg/utils" "github.com/samber/lo" ) @@ -263,10 +262,6 @@ func (self *CommitFileTreeViewModel) IsFiltering() bool { // used for type switch func (self *CommitFileTreeViewModel) IsFilterableContext() {} -func (self *CommitFileTreeViewModel) FilterPrefix(tr *i18n.TranslationSet) string { - return tr.FilterPrefix -} - func (self *CommitFileTreeViewModel) GetSearchHistory() *utils.HistoryBuffer[string] { return self.searchHistory } diff --git a/pkg/gui/filetree/file_tree_view_model.go b/pkg/gui/filetree/file_tree_view_model.go index a5971f592..68829b444 100644 --- a/pkg/gui/filetree/file_tree_view_model.go +++ b/pkg/gui/filetree/file_tree_view_model.go @@ -7,7 +7,6 @@ import ( "github.com/jesseduffield/lazygit/pkg/common" "github.com/jesseduffield/lazygit/pkg/gui/context/traits" "github.com/jesseduffield/lazygit/pkg/gui/types" - "github.com/jesseduffield/lazygit/pkg/i18n" "github.com/jesseduffield/lazygit/pkg/utils" "github.com/samber/lo" ) @@ -274,10 +273,6 @@ func (self *FileTreeViewModel) IsFiltering() bool { // used for type switch func (self *FileTreeViewModel) IsFilterableContext() {} -func (self *FileTreeViewModel) FilterPrefix(tr *i18n.TranslationSet) string { - return tr.FilterPrefix -} - func (self *FileTreeViewModel) GetSearchHistory() *utils.HistoryBuffer[string] { return self.searchHistory } diff --git a/pkg/gui/types/context.go b/pkg/gui/types/context.go index e8b33a7d8..2ef798a34 100644 --- a/pkg/gui/types/context.go +++ b/pkg/gui/types/context.go @@ -4,7 +4,6 @@ import ( "github.com/jesseduffield/lazygit/pkg/config" "github.com/jesseduffield/lazygit/pkg/gocui" "github.com/jesseduffield/lazygit/pkg/gui/patch_exploring" - "github.com/jesseduffield/lazygit/pkg/i18n" "github.com/jesseduffield/lazygit/pkg/utils" "github.com/sasha-s/go-deadlock" ) @@ -140,7 +139,6 @@ type IFilterableContext interface { ReApplyFilter(bool) IsFiltering() bool IsFilterableContext() - FilterPrefix(tr *i18n.TranslationSet) string } type ISearchableContext interface {