def row_form

cli@0.2.0.0 · cli.bend:5544

import cli@0.2.0.0/cli.bend as Cli
import Base

5544# A cell that fits takes its text after padding to C; one that does not
5545# stands alone, its text on the next lines at max(C, 10).
5546def row_form(fits: Bool, cell: List<&2, Segment>, lw: Nat, right: String,
5547    w: Nat, +c: Nat) -> List<&2, Segment>:
5548  match fits:
5549    case True{}:
5550      plain("  ") <> List.append(&2, Segment, cell,
5551        plain(String.repeat(" ", (c - 2n - lw : Nat))) <>
5552          first_then(String.lines(wrap(right, (w - c : Nat))), c))
5553    case False{}:
5554      +col = Nat.max(c, 10n)
5555      plain("  ") <> List.append(&2, Segment, cell,
5556        pad_lines(String.lines(wrap(right, (w - col : Nat))), col))

Uses (14)

Used by (1)