Pure display-width measurement and layout for termcolor.
Styles remain attached to Text; no terminal IO or escape emission occurs here.
Terminal layout needs display-width-aware wrapping and alignment while preserving styling and remaining independent of the terminal.
This project is maintained by its author with AI-assisted development tools. Changes are reviewed, tested, and remain the maintainer's responsibility.
Display-cell width, truncation, wrapping, padding, alignment, columns, boxes, splitLines, and
joinLines. The default width is 80 columns until a caller supplies a terminal width.
import TermColor.Layout
open TermColor TermColor.Layout
def message : Text := Text.styled "界面" Style.bold
#eval Text.width message
#eval (wrapLines 3 message).plainTextlake build TermColor.Layout TermColor.Layout.Properties demo
lake exe demoUsed by termcolor-widgets,
termcolor-terminal, and
argus. Diagnostics are provided by
termcolor-diagnostics.
Apache-2.0.
