TermColor.Layout.Basic: pure styled-text layout #
These operations preserve segment styles and never emit ANSI escapes. Rendering remains the
responsibility of TermColor.Text.render.
Default fallback for layout that has no terminal width yet.
Equations
Instances For
Equations
- TermColor.Layout.instBEqAlignment.beq x✝ y✝ = (x✝.ctorIdx == y✝.ctorIdx)
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Equations
Split a Text into logical lines on '\n', preserving each segment's style.
The counterpart to joinLines. Callers laying out their own multi-line cells need this to
indent or pad continuation lines: columns aligns every column to its width, so a caller
that wants no trailing padding on the last column has to split and rejoin itself.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Join logical lines with newline separators.
Equations
- TermColor.Layout.joinLines [] = TermColor.Text.empty
- TermColor.Layout.joinLines (first :: rest) = List.foldl (fun (result line : TermColor.Text) => result ++ TermColor.Text.plain "\n" ++ line) first rest
Instances For
Pad every logical line on the right to target columns.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Pad every logical line on the left to target columns.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Align every logical line to target columns.
Equations
- One or more equations did not get rendered due to their size.
- TermColor.Layout.align target TermColor.Layout.Alignment.left text = TermColor.Layout.padRight target text
- TermColor.Layout.align target TermColor.Layout.Alignment.right text = TermColor.Layout.padLeft target text
Instances For
Keep at most limit display columns on each logical line.
Equations
- TermColor.Layout.truncate limit text = TermColor.Layout.mapLines✝ (TermColor.Layout.takeWidth✝ limit) text
Instances For
Wrap every logical line to at most limit display columns. A wide first character may occupy
two columns when limit is one, since splitting a character is impossible.
Equations
- TermColor.Layout.wrapLines limit text = TermColor.Layout.joinLines (List.flatMap (TermColor.Layout.wrapLine✝ (max 1 limit)) (TermColor.Layout.splitLines text))
Instances For
Wrap every logical line to at most limit display columns, breaking at spaces where
possible. A word wider than limit is split like wrapLines; spaces at a break are dropped.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Lay out one row of styled cells as fixed-width columns. Cells wrap before alignment.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Characters used to draw a box.
Equations
- One or more equations did not get rendered due to their size.
- TermColor.Layout.instBEqBoxChars.beq x✝¹ x✝ = false
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Equations
ASCII characters for terminals without Unicode box drawing.
Equations
- TermColor.Layout.asciiBoxChars = { topLeft := '+', topRight := '+', bottomLeft := '+', bottomRight := '+', horizontal := '-', vertical := '|' }
Instances For
- chars : BoxChars
Characters used for the border.
- borderStyle : Style
Style applied to border characters.
- padding : Nat
Number of spaces between the border and content.
Optional one-line title in the top border.
- titleAlignment : Alignment
Horizontal alignment of the title.
Maximum outer width, including borders and padding.
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
- TermColor.Layout.instBEqBoxConfig.beq x✝¹ x✝ = false
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.