From 2e6645f2a5bab81b693e4a8dd44380ed9123a185 Mon Sep 17 00:00:00 2001 From: mariano Date: Sat, 8 Aug 2026 17:35:00 -0500 Subject: [PATCH] feat: widen tables to 100 columns so the detail column is readable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit render_table squeezes the single widest column to fit its budget, and that column is always the free-text one — so every column the budget spent elsewhere came straight out of the workout description, the part actually worth reading. Plan rows were wrapping detail at ~17 characters. Fixed rather than read from $COLUMNS on purpose: env-dependent output would make the e2e layout assertions unreproducible. The width expect now asserts against the constant instead of a literal 80, which is why it failed on a change that was purely the number moving. --- src/Render.roc | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/Render.roc b/src/Render.roc index 16e607e..abb7399 100644 --- a/src/Render.roc +++ b/src/Render.roc @@ -5,12 +5,18 @@ Render :: [].{ # aligned table: headers + rows -> multiline string. # Keeps the WHOLE table within max_total display-columns so a row never wraps - # in an ~80-column terminal — but WITHOUT losing text. Columns take their - # natural width; if the table would overflow, the single widest column (in - # practice a free-text `detail` or a long activity name) is squeezed and its - # text is WORD-WRAPPED across continuation lines within the same row. The full - # text is always shown; it just spans several physical lines. - max_total = 80 + # in the terminal — but WITHOUT losing text. Columns take their natural width; + # if the table would overflow, the single widest column (in practice a free-text + # `detail` or a long activity name) is squeezed and its text is WORD-WRAPPED + # across continuation lines within the same row. The full text is always shown; + # it just spans several physical lines. + # + # 100, not 80: the squeezed column is ALWAYS the free-text one, so every column + # the budget spends elsewhere comes straight out of the workout description — + # the part actually worth reading. A fixed number rather than $COLUMNS on + # purpose: env-dependent output would make the e2e layout assertions + # (bar-never-wraps, marker placement) unreproducible. + max_total = 100 min_col = 12 # widest display-width among a set of already-wrapped lines @@ -634,14 +640,16 @@ expect { ) Str.contains(t, "Long EASY ride") and Str.contains(t, "chasing wheels") and List.len(Str.split_on(t, "\n")) > 5 } -# the whole table stays within 80 display-columns (the top border spans full width) +# the whole table stays within the budget (the top border spans full width). Asserted +# against the constant, not a literal: hard-coding 80 made this fail the moment the budget +# moved, for no reason other than the number being written down twice. expect { long = "Long EASY ride 90min-2h outdoor Z2 ONLY conversational the whole way no chasing wheels keep it truly easy today" t = Render.render_table( ["day", "date", "type", "status", "detail", "id"], [["Sat", "2026-08-08", "endurance", "open", long, "18"]], ) - Render.display_width(List.get(Str.split_on(t, "\n"), 0).ok_or("")) <= 80 + Render.display_width(List.get(Str.split_on(t, "\n"), 0).ok_or("")) <= Render.max_total } # a short cell is rendered whole on one line — exact match proves no wrapping expect {