summaryrefslogtreecommitdiffstats
path: root/pkg/gui/controllers/quit_actions.go
diff options
context:
space:
mode:
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