Library
Module
Module type
Parameter
Class
Class type
This module should be used to output boxes directly to a terminal, or another area of monospace text
Set which function is used to compute string length. Typically to be used with a unicode-sensitive length function. An example of such a function for utf8 encoded strings is the following (it uses the Uutf
and Uucp
libraries):
let string_leng s i len =
Uutf.String.fold_utf_8 ~pos:i ~len
(fun n _ c -> n+ max 0 (Uucp.Break.tty_width_hint c)) 0 s
Note that this function assumes there is no newline character in the given string.
val to_string : PrintBox.t -> string
Returns a string representation of the given structure.
val to_string_with : style:bool -> PrintBox.t -> string
Returns a string representation of the given structure, with style.
val output :
?style:bool ->
?indent:int ->
Stdlib.out_channel ->
PrintBox.t ->
unit
Outputs the given structure on the channel.
val pp : Stdlib.Format.formatter -> PrintBox.t -> unit
Pretty-print the box into this formatter.
val pp_with : style:bool -> Stdlib.Format.formatter -> PrintBox.t -> unit
Pretty-print the box into this formatter, with style.