diff --git a/pkg/gui/context.go b/pkg/gui/context.go index 67ded3060..56058743c 100644 --- a/pkg/gui/context.go +++ b/pkg/gui/context.go @@ -665,18 +665,18 @@ func (gui *Gui) onViewFocusChange() error { return nil } -func (gui *Gui) onViewFocusLost(v *gocui.View, newView *gocui.View) error { - if v == nil { +func (gui *Gui) onViewFocusLost(oldView *gocui.View, newView *gocui.View) error { + if oldView == nil { return nil } - if v.IsSearching() && newView.Name() != "search" { + if oldView.IsSearching() && newView != gui.Views.Search { if err := gui.onSearchEscape(); err != nil { return err } } - if v.Name() == "commitFiles" && newView.Name() != "main" && newView.Name() != "secondary" { + if oldView == gui.Views.CommitFiles && newView != gui.Views.Main && newView != gui.Views.Secondary && newView != gui.Views.Search { gui.resetWindowForView("commitFiles") if err := gui.deactivateContext(gui.State.Contexts.CommitFiles); err != nil { return err diff --git a/vendor/github.com/jesseduffield/gocui/view.go b/vendor/github.com/jesseduffield/gocui/view.go index 4e4de080d..b13074242 100644 --- a/vendor/github.com/jesseduffield/gocui/view.go +++ b/vendor/github.com/jesseduffield/gocui/view.go @@ -170,7 +170,7 @@ func (v *View) gotoNextMatch() error { if len(v.searcher.searchPositions) == 0 { return nil } - if v.searcher.currentSearchIndex == len(v.searcher.searchPositions)-1 { + if v.searcher.currentSearchIndex >= len(v.searcher.searchPositions)-1 { v.searcher.currentSearchIndex = 0 } else { v.searcher.currentSearchIndex++