1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-08-24 19:39:16 +02:00

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

View File

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