mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-10 07:36:27 -04:00
Extract applying a filter to a context
A filter can come from somewhere other than the search prompt: a menu that filters as you type has its own input field, and needs to apply what is typed there without going through the prompt's state. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
45d68bccc2
commit
a9fe055af4
|
|
@ -225,9 +225,7 @@ func (self *SearchHelper) OnPromptContentChanged(searchString string) {
|
|||
state := self.searchState()
|
||||
switch context := state.Context.(type) {
|
||||
case types.IFilterableContext:
|
||||
context.SetSelection(0)
|
||||
context.SetFilter(searchString, self.c.UserConfig().Gui.UseFuzzySearch())
|
||||
self.c.PostRefreshUpdate(context)
|
||||
self.ApplyFilter(context, searchString)
|
||||
case types.ISearchableContext:
|
||||
// do nothing
|
||||
default:
|
||||
|
|
@ -235,6 +233,12 @@ func (self *SearchHelper) OnPromptContentChanged(searchString string) {
|
|||
}
|
||||
}
|
||||
|
||||
func (self *SearchHelper) ApplyFilter(context types.IFilterableContext, filter string) {
|
||||
context.SetSelection(0)
|
||||
context.SetFilter(filter, self.c.UserConfig().Gui.UseFuzzySearch())
|
||||
self.c.PostRefreshUpdate(context)
|
||||
}
|
||||
|
||||
func (self *SearchHelper) ReApplyFilter(context types.Context) {
|
||||
filterableContext, ok := context.(types.IFilterableContext)
|
||||
if ok {
|
||||
|
|
|
|||
Loading…
Reference in a new issue