package printbox-text

  1. Overview
  2. Docs
Text renderer for printbox, using unicode edges

Install

Dune Dependency

Authors

Maintainers

Sources

v0.6.tar.gz
md5=052766382422020d9e92641d788c1b50
sha512=95739aa35afae261912a192faff55a6f2293cf82f6e814a7329a88a03c8aaf6d26eab124687b81f98b92d96f7bbe5eaf8a376dcacca12c74f769eadede26da20

doc/printbox-text/PrintBox_text/index.html

Module PrintBox_textSource

Render to Text

This module should be used to output boxes directly to a terminal, or another area of monospace text

Sourceval set_string_len : (String.t -> int -> int -> int) -> unit

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.

  • since 0.3, this is also used in [printbox_unicode] to basically install the code above
Sourceval to_string : PrintBox.t -> string

Returns a string representation of the given structure.

  • parameter style

    if true, emit ANSI codes for styling (default true) (@since 0.3)

Sourceval to_string_with : style:bool -> PrintBox.t -> string

Returns a string representation of the given structure, with style.

  • parameter style

    if true, emit ANSI codes for styling

  • since 0.3
Sourceval output : ?style:bool -> ?indent:int -> out_channel -> PrintBox.t -> unit

Outputs the given structure on the channel.

  • parameter indent

    initial indentation to use

  • parameter style

    if true, emit ANSI codes for styling (default true) (@since 0.3)

Pretty-print the box into this formatter.

  • since 0.2
Sourceval pp_with : style:bool -> Format.formatter -> PrintBox.t -> unit

Pretty-print the box into this formatter, with style.

  • parameter style

    if true, emit ANSI codes for styling

  • since 0.3
OCaml

Innovation. Community. Security.