notty

Declaring terminals
IN THIS PACKAGE
Module Notty_lwt . Term
type t

Construction and destruction

val create : ?dispose:bool -> ?nosig:bool -> ?mouse:bool -> ?bpaste:bool -> ?input:Lwt_unix.file_descr -> ?output:Lwt_unix.file_descr -> unit -> t

create ~dispose ~nosig ~mouse ~input ~output () creates a new terminal.

Note ~dispose arranges for the terminal to be disposed of at the end of the Lwt main loop, and not at process exit.

See Notty_unix.Term.create.

val release : t -> unit Lwt.t

Commands

val image : t -> Notty.image -> unit Lwt.t
val refresh : t -> unit Lwt.t
val cursor : t -> (int * int) option -> unit Lwt.t

Events

val events : t -> [ Notty.Unescape.event | `Resize of int * int ] Lwt_stream.t

events t is the stream of incoming events.

Invoking release will terminate this stream.

Events are:

  • #Unescape.event, an event from the input fd; or
  • `Resize (int * int) whenever the terminal size changes.

Note This stream is unique; for the same t, events t always returns the same stream.

Properties

val size : t -> int * int

Window size change notifications

Creating a terminal will install a SIGWINCH handler. The handler should not be replaced directly. This API allows the user to monitor deliveries of the signal.

See Notty_unix.Term.Winch.

val winch : unit -> unit Lwt.t

winch () is a thread completing after the next SIGWINCH. A single signal delivery will cause the completion of all waiting winch threads.