summaryrefslogtreecommitdiffstats
path: root/pkg/gui/controllers/quit_actions.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2023-07-03 12:57:11 +1000
committerGitHub <noreply@github.com>2023-07-03 12:57:11 +1000
commit1a36cb9f3fbcf07353b8ae73e8b055d2e0e1d794 (patch)
treef486f588c72676322c341cb9aae209a02cbf9c61 /pkg/gui/controllers/quit_actions.go
parent2be4359e87bee6c737e19b02e4c7896fbc2ebf91 (diff)
parent5d982e1d70aa9a07645a5665130f2e499b7b56c8 (diff)
View filtering (#2680)
Diffstat (limited to 'pkg/gui/controllers/quit_actions.go')
-rw-r--r--pkg/gui/controllers/quit_actions.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/pkg/gui/controllers/quit_actions.go b/pkg/gui/controllers/quit_actions.go
index 2487a62fe..a163f66c8 100644
--- a/pkg/gui/controllers/quit_actions.go
+++ b/pkg/gui/controllers/quit_actions.go
@@ -50,6 +50,19 @@ func (self *QuitActions) confirmQuitDuringUpdate() error {
func (self *QuitActions) Escape() error {
currentContext := self.c.CurrentContext()
+ switch ctx := currentContext.(type) {
+ case types.IFilterableContext:
+ if ctx.IsFiltering() {
+ self.c.Helpers().Search.Cancel()
+ return nil
+ }
+ case types.ISearchableContext:
+ if ctx.IsSearching() {
+ self.c.Helpers().Search.Cancel()
+ return nil
+ }
+ }
+
parentContext, hasParent := currentContext.GetParentContext()
if hasParent && currentContext != nil && parentContext != nil {
// TODO: think about whether this should be marked as a return rather than adding to the stack