eb15371689b00514b16f952c6eb3a5da8d36acbb

Author
dominicdoty <doty.dominic@gmail.com>
Committer
GitHub <noreply@github.com>
Date

Message

fix(ui): repo URL width calculation. (#637)

Previous code only used description width to calculate remaining space.
At that point the desc has already been merged into the header so the header can be used to calculate remaining width correctly.

Diff

 1diff --git a/pkg/ui/pages/repo/repo.go b/pkg/ui/pages/repo/repo.go
 2index 1f3263287de85373737261ae4672bae70ffbab24..adeaeed35ccd33460a5358895c286c6b43e70de2 100644
 3--- a/pkg/ui/pages/repo/repo.go
 4+++ b/pkg/ui/pages/repo/repo.go
 5@@ -340,13 +340,13 @@ func (r *Repo) headerView() string {
 6 		)
 7 	}
 8 	urlStyle := r.common.Styles.URLStyle.
 9-		Width(r.common.Width - lipgloss.Width(desc) - 1).
10+		Width(r.common.Width - lipgloss.Width(header) - 1).
11 		Align(lipgloss.Right)
12 	var url string
13 	if cfg := r.common.Config(); cfg != nil {
14 		url = r.common.CloneCmd(cfg.SSH.PublicURL, r.selectedRepo.Name())
15 	}
16-	url = common.TruncateString(url, r.common.Width-lipgloss.Width(desc)-1)
17+	url = common.TruncateString(url, r.common.Width-lipgloss.Width(header)-1)
18 	url = r.common.Zone.Mark(
19 		fmt.Sprintf("%s-url", r.selectedRepo.Name()),
20 		urlStyle.Render(url),