mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-30 03:23:08 +03:00
Cancel filter/search when hitting escape
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user