8e032c24b06eb5ca552195ae45797c5a2e6dd39b

Author
Christian Rocha <christian@rocha.is>
Committer
Ayman Bagabas <ayman.bagabas@gmail.com>
Date

Message

fix: chroma portions of glamour renders that could break layout

Diff

 1diff --git a/internal/tui/bubbles/repo/bubble.go b/internal/tui/bubbles/repo/bubble.go
 2index e50c4cefe03de86c15419577e1caa92437cacce0..12f0ebbc237961c2510c3e6a0f72b07429e5bf82 100644
 3--- a/internal/tui/bubbles/repo/bubble.go
 4+++ b/internal/tui/bubbles/repo/bubble.go
 5@@ -224,16 +224,14 @@ func (b *Bubble) glamourize(md string) (string, error) {
 6 	if err != nil {
 7 		return "", err
 8 	}
 9-	// For now, truncate long lines in Glamour that would otherwise break the
10-	// layout when wrapping. This is very likely due to #43 in Reflow, which
11-	// has to do with a bug in the way lines longer than the given width are
12-	// wrapped.
13+	// For now, hard-wrap long lines in Glamour that would otherwise break the
14+	// layout when wrapping. This may be due to #43 in Reflow, which has to do
15+	// with a bug in the way lines longer than the given width are wrapped.
16 	//
17 	//     https://github.com/muesli/reflow/issues/43
18 	//
19 	// TODO: solve this upstream in Glamour/Reflow.
20-	mdt = lipgloss.NewStyle().MaxWidth(w).Render(mdt)
21-	return mdt, nil
22+	return wrap.String(mdt, w), nil
23 }
24 
25 func max(a, b int) int {