From 8e032c24b06eb5ca552195ae45797c5a2e6dd39b Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Wed, 26 Jan 2022 20:51:06 -0500 Subject: [PATCH] fix: chroma portions of glamour renders that could break layout --- internal/tui/bubbles/repo/bubble.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/internal/tui/bubbles/repo/bubble.go b/internal/tui/bubbles/repo/bubble.go index e50c4cefe03de86c15419577e1caa92437cacce0..12f0ebbc237961c2510c3e6a0f72b07429e5bf82 100644 --- a/internal/tui/bubbles/repo/bubble.go +++ b/internal/tui/bubbles/repo/bubble.go @@ -224,16 +224,14 @@ func (b *Bubble) glamourize(md string) (string, error) { if err != nil { return "", err } - // For now, truncate long lines in Glamour that would otherwise break the - // layout when wrapping. This is very likely due to #43 in Reflow, which - // has to do with a bug in the way lines longer than the given width are - // wrapped. + // For now, hard-wrap long lines in Glamour that would otherwise break the + // layout when wrapping. This may be due to #43 in Reflow, which has to do + // with a bug in the way lines longer than the given width are wrapped. // // https://github.com/muesli/reflow/issues/43 // // TODO: solve this upstream in Glamour/Reflow. - mdt = lipgloss.NewStyle().MaxWidth(w).Render(mdt) - return mdt, nil + return wrap.String(mdt, w), nil } func max(a, b int) int {