gleamtea/util

Small rendering helpers shared by the bubbles, bound from beamtea’s beamtea_util / beamtea_render. All are ANSI-aware where it matters, so coloured text still lines up.

Values

pub fn lines(view: String) -> List(String)

Split a view into its lines (on \n, trailing \r stripped).

pub fn pad_visible(text: String, width: Int) -> String

Right-pad text to width visible columns, ignoring ANSI escapes in the width calculation (so coloured text lines up correctly).

pub fn truncate(text: String, max: Int) -> String

Truncate text to at most max code points, adding an ellipsis when cut.

pub fn visible_width(text: String) -> Int

The number of visible columns in text, ignoring ANSI escapes.

Search Document