val nil : t
The empty block. a left and right unit to both
val fill : char -> width:int -> height:int -> t
space assume width and height are non-negative
val space : width:int -> height:int -> t
A basic block of text, split on newlines and horizontally aligned as specified.
max_width is provided, split each line of the input on whitespace and wrap words to respect the request. So long as no words are longer than
max_width, the resulting text block will be no wider than
text, but takes a format string like printf
Text block dimensions
val width : t -> int
val height : t -> int
Vertical and horizontal sequence alignment. Both
halign return a list of the same length as the input, with the corresponding elements padded to the appropriate alignment.
If you have a list of a statically known length, using
With_static_lengths.halign below will let the type checker know that the length of the returned list is equal to the length of the input list.
Empty blocks with either horizontal or vertical extent -- useful for specifying a minimum width or height in conjunction with valign or halign, respectively
val hstrut : int -> t
val vstrut : int -> t
Wrap a block with an ANSI escape sequence. The
suffix arguments should render with zero width and height.
val render : t -> string
render a block of text as a string
Alignment of a 2D grid of blocks
val compress_table_header : ?sep_width:int -> [ `Cols of (t * t list * halign) list ] -> [ `Header of t ] * [ `Rows of t list ]
Compress table header according to column widths.
Input: a list of columns of the form (title, values, column alignment). Output: one header block and row sequence. Raises: if the
values lists are not the same length in each column. Example:
first name age first name last name age | last name | | | ==> | | | 30 sue smith 30 sue smith 18 bill rodriguez 18 bill rodriguez 76 rick jones 76 rick jones
module Boxed : sig ... end
Combinators for building up cell structures separated by box characters: e.g.
val vsep : t
vsep = vstrut 1
val hsep : t
hsep = hstrut 1
module With_static_lengths : sig ... end
Versions of halign and valign with the invariant about list length encoded into the types.