From 9e3e1a7b3a4b084677018b9a39219d342b1c1a4e Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Sat, 12 Apr 2025 19:46:14 +0200 Subject: [PATCH 1/2] Fix truncating branches to the right edge of the view when scrolled to the left When scrolling the view to the left, the available width becomes the width of the view plus the scroll position. --- pkg/gui/context/branches_context.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/gui/context/branches_context.go b/pkg/gui/context/branches_context.go index faff68ba9..9e30e36cc 100644 --- a/pkg/gui/context/branches_context.go +++ b/pkg/gui/context/branches_context.go @@ -30,7 +30,7 @@ func NewBranchesContext(c *ContextCommon) *BranchesContext { c.State().GetItemOperation, c.State().GetRepoState().GetScreenMode() != types.SCREEN_NORMAL, c.Modes().Diffing.Ref, - c.Views().Branches.InnerWidth(), + c.Views().Branches.InnerWidth()+c.Views().Branches.OriginX(), c.Tr, c.UserConfig(), c.Model().Worktrees, From fa9d75835c5cadf9a7fdc5875745dd7cc1ed40c4 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Sat, 12 Apr 2025 19:47:11 +0200 Subject: [PATCH 2/2] Rerender views if necessary when scrolling horizontally If the context says it wants to rerender when its width changes, we must also rerender when the horizontal scroll position changes. --- pkg/gui/controllers/list_controller.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/gui/controllers/list_controller.go b/pkg/gui/controllers/list_controller.go index c7a589af4..42f15d895 100644 --- a/pkg/gui/controllers/list_controller.go +++ b/pkg/gui/controllers/list_controller.go @@ -74,6 +74,9 @@ func (self *ListController) scrollHorizontal(scrollFunc func()) error { scrollFunc() self.context.HandleFocus(types.OnFocusOpts{}) + if self.context.NeedsRerenderOnWidthChange() == types.NEEDS_RERENDER_ON_WIDTH_CHANGE_WHEN_WIDTH_CHANGES { + self.context.HandleRender() + } return nil }