Text_blockTwo-dimensional blocks of UTF-8 text. This module makes a naive assumption that each Unicode scalar value has a display width of 1. If this is not the case, the width calculations will be incorrect. See String.Utf8.length_in_uchars for details.
val sexp_of_t : t -> Sexplib0.Sexp.tinclude Core.Invariant.S with type t := tval invariant : t -> unitval nil : tThe empty block. a left and right unit to both hcat and vcat
val fill : char -> width:int -> height:int -> tfill and space assume width and height are non-negative
val space : width:int -> height:int -> tval fill_uchar : Core.Uchar.t -> width:int -> height:int -> tFill a space with a Unicode scalar value
type wrap_behavior = {max_width : int;ensure that the resulting text block is no wider than either max_width or the longest word, whichever is longer.
preserve_leading_spaces : bool;whether to preserve leading spaces on each line
*)}Word wrapping behavior for text and friends.
val text : ?align:halign -> ?wrap:wrap_behavior -> string -> tA basic block of UTF-8 text, split on newlines and horizontally aligned as specified.
Word wrapping is done iff wrap is passed. See comment on wrap_behavior for more details.
val textf :
?align:halign ->
?wrap:wrap_behavior ->
('r, unit, string, t) Core.format4 ->
'rLike text, but takes a format string like printf
Text block dimensions
val width : t -> intval height : t -> intVertical and horizontal sequence alignment. Both valign and 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.valign or 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 -> tval vstrut : int -> tWrap a block with an ANSI escape sequence. The prefix and suffix arguments should render with zero width and height.
val render : t -> stringrender 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 ... endmodule Up_or_down : sig ... endval span_banner :
extend_left:bool ->
extend_right:bool ->
length:int ->
points:Up_or_down.t ->
?label:t ->
unit ->
tspan_banner produces text blocks that indicate the extent of something else
extend_left
| extend_right
| | points
| | | span_banner ...
| | | | span_banner ~label ...
| | | | |
true true Up ────────── ─┬────────
label
true false Up ─────────┘ ─┬───────┘
label
false true Up └───────── └┬────────
label
false false Up └────────┘ └┬───────┘
label
true true Down label
────────── ─┴────────
true false Down label
─────────┐ ─┴───────┐
false true Down label
┌───────── ┌┴────────
false false Down label
┌────────┐ ┌┴───────┐ |}];val vsep : tvsep = vstrut 1
val hsep : thsep = hstrut 1
val sexp : ('a -> Core.Sexp.t) -> 'a -> tsexp sexp_of_a a = sexp_of_a a |> Sexp.to_string |> text
module With_static_lengths : sig ... endVersions of halign and valign with the invariant about list length encoded into the types.