diff options
Diffstat (limited to 'internal/render/render.go')
| -rw-r--r-- | internal/render/render.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/internal/render/render.go b/internal/render/render.go index 265ed18..8a36f12 100644 --- a/internal/render/render.go +++ b/internal/render/render.go @@ -271,7 +271,7 @@ func compareSection(sec liturgy.Section, versions []string, width int, lectionar label, blocks := GatherVersion(v, sec, lectionary, lang) var lines []string for _, b := range blocks { - lines = append(lines, strings.Split(wrap(b, w), "\n")...) + lines = append(lines, strings.Split(Wrap(b, w), "\n")...) lines = append(lines, "") } if len(lines) > 0 { @@ -313,7 +313,10 @@ func compareSection(sec liturgy.Section, versions []string, width int, lectionar // line and never splitting a word (even one longer than width), matching // ewangelia.py's textwrap.fill(..., break_long_words=False, // break_on_hyphens=False). -func wrap(line string, width int) string { +// Wrap greedily word-wraps line to width without padding (each output line is +// at most width runes, no trailing spaces), never splitting a word. Shared by +// the CLI, the TUI reader and Compare so all three wrap identically. +func Wrap(line string, width int) string { words := strings.Fields(line) if len(words) == 0 { return "" |
