Smith::UI::LineUtil
Line-level helpers shared by everything that lays text out.
Constants
EMPTY = [] of Span
Class methods
plain(line : StyledLine) : String
Sourcerender(line : StyledLine, io : IO, color : Bool = true) : Nil
Sourceto_ansi(line : StyledLine, color : Bool = true) : String
Sourcetruncate(line : StyledLine, width : Int32, ellipsis : String | Nil = nil) : StyledLine
Cuts a line to width columns, optionally with an ellipsis. Never
splits a double-width character in half: if it does not fit, the cut
happens one column earlier.
width(line : StyledLine) : Int32
Sourcewrap(line : StyledLine, width : Int32) : Array(StyledLine)
Greedy word wrap that keeps styles intact. Words longer than the width are hard-broken; spaces at a wrap point are dropped rather than trailing.