1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-08-10 22:42:00 +02:00

marginally better logic for searching

This commit is contained in:
Jesse Duffield
2021-04-06 10:26:18 +10:00
parent c683f2c96c
commit 5e094c8a7c

View File

@@ -464,14 +464,19 @@ func (gui *Gui) returnFromContext() error {
}
func (gui *Gui) deactivateContext(c Context) error {
// if we are the kind of context that is sent to back upon deactivation, we should do that
if c.GetKind() == TEMPORARY_POPUP || c.GetKind() == PERSISTENT_POPUP || c.GetKey() == COMMIT_FILES_CONTEXT_KEY {
view, err := gui.g.View(c.GetViewName())
if err == nil {
view.Visible = false
view, _ := gui.g.View(c.GetViewName())
if view != nil && view.IsSearching() {
if err := gui.onSearchEscape(); err != nil {
return err
}
}
// if we are the kind of context that is sent to back upon deactivation, we should do that
if view != nil && c.GetKind() == TEMPORARY_POPUP || c.GetKind() == PERSISTENT_POPUP || c.GetKey() == COMMIT_FILES_CONTEXT_KEY {
view.Visible = false
}
if err := c.HandleFocusLost(); err != nil {
return err
}
@@ -674,12 +679,6 @@ func (gui *Gui) onViewFocusLost(oldView *gocui.View, newView *gocui.View) error
return nil
}
if oldView.IsSearching() && newView != gui.Views.Search {
if err := gui.onSearchEscape(); err != nil {
return err
}
}
if oldView == gui.Views.CommitFiles && newView != gui.Views.Main && newView != gui.Views.Secondary && newView != gui.Views.Search {
gui.resetWindowForView(gui.Views.CommitFiles)
if err := gui.deactivateContext(gui.State.Contexts.CommitFiles); err != nil {