diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2023-05-28 13:25:52 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2023-07-03 12:54:14 +1000 |
commit | d67b209e62f8254d5f17ecdb8fe7ff810f000566 (patch) | |
tree | 220b15b574abaf5a68cfa030f25ac3d2f58bf586 /pkg/gui/context.go | |
parent | bf5871cc4fe8bd7f431e5603447ea0bc29b3d642 (diff) |
Move more logic into search helper
Diffstat (limited to 'pkg/gui/context.go')
-rw-r--r-- | pkg/gui/context.go | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/pkg/gui/context.go b/pkg/gui/context.go index 7c669cbff..1c235a93f 100644 --- a/pkg/gui/context.go +++ b/pkg/gui/context.go @@ -201,21 +201,7 @@ func (self *ContextMgr) deactivateContext(c types.Context, opts types.OnFocusLos view, _ := self.gui.c.GocuiGui().View(c.GetViewName()) if opts.NewContextKey != context.SEARCH_CONTEXT_KEY { - - if searchableContext, ok := c.(types.ISearchableContext); ok { - if view != nil && view.IsSearching() { - view.ClearSearch() - searchableContext.ClearSearchString() - self.gui.helpers.Search.Cancel() - } - } - - if filterableContext, ok := c.(types.IFilterableContext); ok { - if filterableContext.IsFiltering() { - filterableContext.ClearFilter() - self.gui.helpers.Search.Cancel() - } - } + self.gui.helpers.Search.CancelSearchIfSearching(c) } // if we are the kind of context that is sent to back upon deactivation, we should do that @@ -246,16 +232,7 @@ func (self *ContextMgr) ActivateContext(c types.Context, opts types.OnFocusOpts) return err } - if searchableContext, ok := c.(types.ISearchableContext); ok { - if searchableContext.IsSearching() { - self.gui.helpers.Search.DisplaySearchPrompt(searchableContext) - } - } - if filterableContext, ok := c.(types.IFilterableContext); ok { - if filterableContext.IsFiltering() { - self.gui.helpers.Search.DisplayFilterPrompt(filterableContext) - } - } + self.gui.helpers.Search.DisplaySearchInfoIfSearching(c) desiredTitle := c.Title() if desiredTitle != "" { |