Fix truncation of branches when scrolling branches panel to the left (#4483)

- **PR Description**

Truncation of long branch names didn't take the horizontal scroll
position into account; when scrolling the panel to the left using `H`,
the long names were truncated way before the right edge of the view.
This commit is contained in:
Stefan Haller 2025-04-20 15:52:20 +02:00 committed by GitHub
commit 89ba3f2b1a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View file

@ -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,

View file

@ -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
}