Module Ansi_text.Control

include module type of Control
type clear_screen

Variant for EraseDisplay options (ANSI-CSI 0-3 J)

type clear_line

Variant for EraseLine options (ANSI-CSI 0-2 K)

type t =
  1. | CursorUp of int option
  2. | CursorDown of int option
  3. | CursorForward of int option
  4. | CursorBackward of int option
  5. | CursorNextLine of int option
  6. | CursorPrevLine of int option
  7. | CursorToCol of int option
  8. | CursorToPos of int option * int option
  9. | EraseDisplay of clear_screen option
  10. | EraseLine of clear_line option
  11. | ScrollUp of int option
  12. | ScrollDown of int option
  13. | Unknown of string

Represents a subset of the ANSI-CSI spec: https://en.wikipedia.org/wiki/ANSI_escape_code#Control_Sequence_Introducer_commands

include Ppx_compare_lib.Comparable.S with type t := t
val compare : t -> t -> int
include Ppx_compare_lib.Equal.S with type t := t
val equal : t -> t -> bool
include Ppx_compare_lib.Equal.S__local with type t := t
include Ppx_quickcheck_runtime.Quickcheckable.S with type t := t
val quickcheck_generator : t Base_quickcheck.Generator.t
val quickcheck_observer : t Base_quickcheck.Observer.t
val quickcheck_shrinker : t Base_quickcheck.Shrinker.t
include Sexplib0.Sexpable.S with type t := t
include Sexplib0.Sexpable.Of_sexp with type t := t
val t_of_sexp : Sexplib0.Sexp.t -> t
include Sexplib0.Sexpable.Sexp_of with type t := t
val sexp_of_t : t -> Sexplib0.Sexp.t
val of_csi : params:string -> terminal:char -> t

Make a Control.t from bytes extracted from a parsed string. For example the parser, when handling:

"\027[;5H"

would invoke:

of_csi ~params:";5" ~terminal:'H'

yielding:

CursorToPos (None, Some 5)
val to_string : t -> string

Converts a Control.t back to an ANSI-CSI string. For example

  to_string (CursorToCol (Some 12)) = "\027[12G"
val to_string_hum : t -> string

A somewhat human-readable name for what the control sequence does.