summaryrefslogtreecommitdiff
path: root/internal/render
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-07-23 23:28:15 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-07-23 23:28:15 +0200
commit9ec2c438a39542ec485e221d485c43b04d692aca (patch)
tree88e881306215de030ef70279be4de9c6d533e112 /internal/render
parentf73decedab916d336247d4ea43ead2b7f7da1e83 (diff)
downloadlectio-9ec2c438a39542ec485e221d485c43b04d692aca.tar.gz
lectio-9ec2c438a39542ec485e221d485c43b04d692aca.zip
tui: fix width-wrap garbling + straight-aligned verse column (export render.Wrap, hanging indent); strip niedziela summary subtitle (tui/cli/web); web verse grid alignment; refrain-italic pl-only
Diffstat (limited to 'internal/render')
-rw-r--r--internal/render/render.go7
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 ""