diff --git a/pkg/gui/controllers/filtering_menu_action.go b/pkg/gui/controllers/filtering_menu_action.go index 7c9de7973..f815d5b3f 100644 --- a/pkg/gui/controllers/filtering_menu_action.go +++ b/pkg/gui/controllers/filtering_menu_action.go @@ -74,5 +74,6 @@ func (self *FilteringMenuAction) setFiltering(path string) error { return self.c.Refresh(types.RefreshOptions{Scope: []types.RefreshableView{types.COMMITS}, Then: func() { self.c.Contexts().LocalCommits.SetSelectedLineIdx(0) + self.c.Contexts().LocalCommits.FocusLine() }}) } diff --git a/pkg/gui/controllers/list_controller.go b/pkg/gui/controllers/list_controller.go index 0a6de821a..1ca3a1e12 100644 --- a/pkg/gui/controllers/list_controller.go +++ b/pkg/gui/controllers/list_controller.go @@ -54,12 +54,6 @@ func (self *ListController) HandleScrollUp() error { scrollHeight := self.c.UserConfig.Gui.ScrollHeight self.context.GetViewTrait().ScrollUp(scrollHeight) - // we only need to do a line change if our line has been pushed out of the viewport, because - // at the moment much logic depends on the selected line always being visible - if !self.isSelectedLineInViewPort() { - return self.handleLineChange(-scrollHeight) - } - return nil } @@ -67,19 +61,9 @@ func (self *ListController) HandleScrollDown() error { scrollHeight := self.c.UserConfig.Gui.ScrollHeight self.context.GetViewTrait().ScrollDown(scrollHeight) - if !self.isSelectedLineInViewPort() { - return self.handleLineChange(scrollHeight) - } - return nil } -func (self *ListController) isSelectedLineInViewPort() bool { - selectedLineIdx := self.context.GetList().GetSelectedLineIdx() - startIdx, length := self.context.GetViewTrait().ViewPortYBounds() - return selectedLineIdx >= startIdx && selectedLineIdx < startIdx+length -} - func (self *ListController) scrollHorizontal(scrollFunc func()) error { scrollFunc() diff --git a/pkg/gui/controllers/stash_controller.go b/pkg/gui/controllers/stash_controller.go index 3e1b65ce8..4b5135884 100644 --- a/pkg/gui/controllers/stash_controller.go +++ b/pkg/gui/controllers/stash_controller.go @@ -187,6 +187,7 @@ func (self *StashController) handleRenameStashEntry(stashEntry *models.StashEntr return err } self.context().SetSelectedLineIdx(0) // Select the renamed stash + self.context().FocusLine() return nil }, }) diff --git a/pkg/gui/layout.go b/pkg/gui/layout.go index 5b3e6845f..35dbe55b7 100644 --- a/pkg/gui/layout.go +++ b/pkg/gui/layout.go @@ -131,8 +131,6 @@ func (gui *Gui) layout(g *gocui.Gui) error { continue } - listContext.FocusLine() - view.SelBgColor = theme.GocuiSelectedLineBgColor // I doubt this is expensive though it's admittedly redundant after the first render