Fix right-alignment of divergence from base branch for branch checked out in a worktree (#4824)

- **PR Description**

We didn't take the worktree icon into account properly, so the
divergence indication was offset to the left by two characters in this
case.

I haven't used worktrees myself so far, so I didn't notice this before.
This commit is contained in:
Stefan Haller 2025-08-14 14:30:51 +02:00 committed by GitHub
commit 389ff29871
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -71,10 +71,11 @@ func getBranchDisplayStrings(
if showCommitHash {
availableWidth -= utils.COMMIT_HASH_SHORT_SIZE + 1
}
paddingNeededForDivergence := availableWidth
if checkedOutByWorkTree {
availableWidth -= utils.StringWidth(worktreeIcon) + 1
}
paddingNeededForDivergence := availableWidth
if len(branchStatus) > 0 {
availableWidth -= utils.StringWidth(utils.Decolorise(branchStatus)) + 1