583b01c938ead7ad81086ff23c6052cd8b896958

Author
Christian Rocha <christian@rocha.is>
Committer
Christian Rocha <christian@rocha.is>
Date

Message

Solve away a magic number when determining Glamour width

Diff

 1diff --git a/tui/bubbles/repo/bubble.go b/tui/bubbles/repo/bubble.go
 2index 71b9f8507ba114db67d8433e1b665ffa7fd18f3b..5d379d9ebe22faccfcca05ed525f35e90936012d 100644
 3--- a/tui/bubbles/repo/bubble.go
 4+++ b/tui/bubbles/repo/bubble.go
 5@@ -148,8 +148,7 @@ func (b *Bubble) View() string {
 6 	if b.Active {
 7 		bs = bs.BorderForeground(b.styles.ActiveBorderColor)
 8 	}
 9-	body := bs.
10-		Width(b.width - b.widthMargin - b.styles.RepoBody.GetVerticalFrameSize()).
11+	body := bs.Width(b.width - b.widthMargin - b.styles.RepoBody.GetVerticalFrameSize()).
12 		Height(b.height - b.heightMargin - lipgloss.Height(header)).
13 		Render(b.readmeViewport.View())
14 	return header + body
15@@ -204,8 +203,7 @@ func (b *Bubble) templatize(mdt string) (string, error) {
16 }
17 
18 func (b *Bubble) glamourize(md string) (string, error) {
19-	// TODO: read gaps in appropriate style to remove the magic number below.
20-	w := b.width - b.widthMargin - 4
21+	w := b.width - b.widthMargin - b.styles.RepoBody.GetHorizontalFrameSize()
22 	if w > glamourMaxWidth {
23 		w = glamourMaxWidth
24 	}