Skip to content

About

Unicode-aware display width and pure text layout for Lean 4

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

lean-termcolor-layout

CI Release Lean 4 Docs License

Pure display-width measurement and layout for termcolor. Styles remain attached to Text; no terminal IO or escape emission occurs here.

Problem

Terminal layout needs display-width-aware wrapping and alignment while preserving styling and remaining independent of the terminal.

TermColor layout demo

Development

This project is maintained by its author with AI-assisted development tools. Changes are reviewed, tested, and remain the maintainer's responsibility.

Provides

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).plainText

Build

lake build TermColor.Layout TermColor.Layout.Properties demo
lake exe demo

Related projects

Used by termcolor-widgets, termcolor-terminal, and argus. Diagnostics are provided by termcolor-diagnostics.

License

Apache-2.0.

About

Unicode-aware display width and pure text layout for Lean 4

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages