Cli.row_form: def of cli@0.2.0.0 Import: import cli@0.2.0.0/cli.bend as Cli Lines 5544-5556 of cli@0.2.0.0/cli.bend: https://jend.leeeet.dev/read.txt?path=cli@0.2.0.0/cli.bend&start_line=5544&end_line=5556 import Base # A cell that fits takes its text after padding to C; one that does not # stands alone, its text on the next lines at max(C, 10). def row_form(fits: Bool, cell: List<&2, Segment>, lw: Nat, right: String, w: Nat, +c: Nat) -> List<&2, Segment>: match fits: case True{}: plain(" ") <> List.append(&2, Segment, cell, plain(String.repeat(" ", (c - 2n - lw : Nat))) <> first_then(String.lines(wrap(right, (w - c : Nat))), c)) case False{}: +col = Nat.max(c, 10n) plain(" ") <> List.append(&2, Segment, cell, pad_lines(String.lines(wrap(right, (w - col : Nat))), col)) Uses (14): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List.append https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.max https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.sub https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String.lines https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String.repeat https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=Segment https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=first_then https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=pad_lines https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=plain https://jend.leeeet.dev/definition.txt?path=cli@0.2.0.0/cli.bend&name=wrap