sig
  val with_raw_mode : (unit -> 'Lwt.t) -> 'Lwt.t
  val raw_mode : unit -> bool
  val enter_drawing_mode : unit -> unit Lwt.t
  val leave_drawing_mode : unit -> unit Lwt.t
  val show_cursor : unit -> unit Lwt.t
  val hide_cursor : unit -> unit Lwt.t
  val clear_screen : unit -> unit Lwt.t
  val clear_line : unit -> unit Lwt.t
  val goto_beginning_of_line : int -> unit Lwt.t
  type size = { lines : int; columns : int; }
  val size : Lwt_term.size React.signal
  val columns : int React.signal
  val lines : int React.signal
  val parse_key_raw : Text.t Lwt_stream.t -> Text.t Lwt.t
  type key =
      Key of Text.t
    | Key_up
    | Key_down
    | Key_left
    | Key_right
    | Key_f of int
    | Key_next_page
    | Key_previous_page
    | Key_home
    | Key_end
    | Key_insert
    | Key_delete
    | Key_control of char
  val string_of_key : Lwt_term.key -> string
  val control_mapping : (int * char) list
  val key_enter : Lwt_term.key
  val key_escape : Lwt_term.key
  val key_tab : Lwt_term.key
  val key_backspace : Lwt_term.key
  val sequence_mapping : (Text.t * Lwt_term.key) list
  val decode_key : Text.t -> Lwt_term.key
  val standard_input : Text.t Lwt_stream.t
  val read_key : unit -> Lwt_term.key Lwt.t
  type color = int
  val set_color : Lwt_term.color -> int * int * int -> unit Lwt.t
  val default : Lwt_term.color
  val black : Lwt_term.color
  val red : Lwt_term.color
  val green : Lwt_term.color
  val yellow : Lwt_term.color
  val blue : Lwt_term.color
  val magenta : Lwt_term.color
  val cyan : Lwt_term.color
  val white : Lwt_term.color
  val lblack : Lwt_term.color
  val lred : Lwt_term.color
  val lgreen : Lwt_term.color
  val lyellow : Lwt_term.color
  val lblue : Lwt_term.color
  val lmagenta : Lwt_term.color
  val lcyan : Lwt_term.color
  val lwhite : Lwt_term.color
  type styled_text_instruction =
      Text of Text.t
    | Reset
    | Bold
    | Underlined
    | Blink
    | Inverse
    | Hidden
    | Foreground of Lwt_term.color
    | Background of Lwt_term.color
  type styled_text = Lwt_term.styled_text_instruction list
  val textf :
    ('a, unit, string, Lwt_term.styled_text_instruction) Pervasives.format4 ->
    'a
  val text : Text.t -> Lwt_term.styled_text_instruction
  val reset : Lwt_term.styled_text_instruction
  val bold : Lwt_term.styled_text_instruction
  val underlined : Lwt_term.styled_text_instruction
  val blink : Lwt_term.styled_text_instruction
  val inverse : Lwt_term.styled_text_instruction
  val hidden : Lwt_term.styled_text_instruction
  val fg : Lwt_term.color -> Lwt_term.styled_text_instruction
  val bg : Lwt_term.color -> Lwt_term.styled_text_instruction
  val strip_styles : Lwt_term.styled_text -> Text.t
  val styled_length : Lwt_term.styled_text -> int
  val write_styled :
    Lwt_text.output_channel -> Lwt_term.styled_text -> unit Lwt.t
  val printc : Lwt_term.styled_text -> unit Lwt.t
  val eprintc : Lwt_term.styled_text -> unit Lwt.t
  val printlc : Lwt_term.styled_text -> unit Lwt.t
  val eprintlc : Lwt_term.styled_text -> unit Lwt.t
  type style = {
    bold : bool;
    underlined : bool;
    blink : bool;
    inverse : bool;
    hidden : bool;
    foreground : Lwt_term.color;
    background : Lwt_term.color;
  }
  type point = { char : Text.t; style : Lwt_term.style; }
  val blank : Lwt_term.point
  val render : Lwt_term.point array array -> unit Lwt.t
  val render_update :
    Lwt_term.point array array -> Lwt_term.point array array -> unit Lwt.t
  module Zone :
    sig
      type t = {
        points : Lwt_term.point array array;
        x : int;
        y : int;
        width : int;
        height : int;
      }
      val points : Lwt_term.Zone.t -> Lwt_term.point array array
      val x : Lwt_term.Zone.t -> int
      val y : Lwt_term.Zone.t -> int
      val width : Lwt_term.Zone.t -> int
      val height : Lwt_term.Zone.t -> int
      val make : width:int -> height:int -> Lwt_term.Zone.t
      val sub :
        zone:Lwt_term.Zone.t ->
        x:int -> y:int -> width:int -> height:int -> Lwt_term.Zone.t
      val inner : Lwt_term.Zone.t -> Lwt_term.Zone.t
    end
  module Draw :
    sig
      val get : zone:Lwt_term.Zone.t -> x:int -> y:int -> Lwt_term.point
      val set :
        zone:Lwt_term.Zone.t ->
        x:int -> y:int -> point:Lwt_term.point -> unit
      val map :
        zone:Lwt_term.Zone.t ->
        x:int -> y:int -> (Lwt_term.point -> Lwt_term.point) -> unit
      val text :
        zone:Lwt_term.Zone.t -> x:int -> y:int -> text:Text.t -> unit
      val textf :
        Lwt_term.Zone.t ->
        int -> int -> ('a, unit, string, unit) Pervasives.format4 -> 'a
      val textc :
        zone:Lwt_term.Zone.t ->
        x:int -> y:int -> text:Lwt_term.styled_text -> unit
    end
end