diff --git a/pkg/gui/context/list_context_trait.go b/pkg/gui/context/list_context_trait.go index cb435c035..cc1d402c0 100644 --- a/pkg/gui/context/list_context_trait.go +++ b/pkg/gui/context/list_context_trait.go @@ -30,7 +30,7 @@ func (self *ListContextTrait) FocusLine() { // Doing this at the end of the layout function because we need the view to be // resized before we focus the line, otherwise if we're in accordion mode - // the view could be squashed and won't how to adjust the cursor/origin. + // the view could be squashed and won't know how to adjust the cursor/origin. // Also, refreshing the viewport needs to happen after the view has been resized. self.c.AfterLayout(func() error { oldOrigin, _ := self.GetViewTrait().ViewPortYBounds() diff --git a/pkg/gui/context/patch_explorer_context.go b/pkg/gui/context/patch_explorer_context.go index c9144e1ab..79d585a12 100644 --- a/pkg/gui/context/patch_explorer_context.go +++ b/pkg/gui/context/patch_explorer_context.go @@ -94,11 +94,6 @@ func (self *PatchExplorerContext) Render() { self.c.Render() } -func (self *PatchExplorerContext) Focus() { - self.FocusSelection() - self.c.Render() -} - func (self *PatchExplorerContext) setContent() { self.GetView().SetContent(self.GetContentToRender()) } diff --git a/pkg/gui/patch_exploring/focus.go b/pkg/gui/patch_exploring/focus.go index 3548f09d4..cf917cd4d 100644 --- a/pkg/gui/patch_exploring/focus.go +++ b/pkg/gui/patch_exploring/focus.go @@ -22,7 +22,7 @@ func calculateNewOriginWithNeededAndWantedIdx(currentOrigin int, bufferHeight in allowedChange := bottom - needToSeeIdx return origin - min(requiredChange, allowedChange) } else if wantToSeeIdx >= bottom { - requiredChange := wantToSeeIdx - bottom + requiredChange := wantToSeeIdx + 1 - bottom allowedChange := needToSeeIdx - origin return origin + min(requiredChange, allowedChange) } diff --git a/pkg/gui/types/context.go b/pkg/gui/types/context.go index 1c9759486..bbca0147a 100644 --- a/pkg/gui/types/context.go +++ b/pkg/gui/types/context.go @@ -192,7 +192,6 @@ type IPatchExplorerContext interface { GetIncludedLineIndices() []int RenderAndFocus() Render() - Focus() GetContentToRender() string NavigateTo(selectedLineIdx int) GetMutex() *deadlock.Mutex