package notty
Install
    
    dune-project
 Dependency
Authors
Maintainers
Sources
sha256=74659fb14073db4438989891ab24f24bef81aa497dac16d9a67f9a1c9c200824
    
    
  sha512=6e21d44fe39f3d80884b87635bebae55cb2b931ef74f9184ba4d74cc3e51cb0b3e976c3b6dc61d377288504e8bfabe21acdc1069eacb30df1fbf6686b80f7c6b
    
    
  doc/notty.unix/Notty_unix/Term/index.html
Module Notty_unix.TermSource
Terminal IO abstraction for fullscreen, interactive applications.
This module provides both input and output. It assumes exclusive ownership of the IO streams between initialization and shutdown.
Representation of the terminal, giving structured access to IO.
Construction and destruction
val create : 
  ?dispose:bool ->
  ?nosig:bool ->
  ?mouse:bool ->
  ?bpaste:bool ->
  ?input:Unix.file_descr ->
  ?output:Unix.file_descr ->
  unit ->
  tcreate ~dispose ~nosig ~mouse ~input ~output () creates a fresh terminal. It has the following side effects:
Unix.tcsetattris applied toinputto disable echo and canonical mode.outputis set to alternate screen mode, and the cursor is hidden. Mouse and bracketed paste reporting are (optionally) enabled.SIGWINCHsignal, normally ignored, is handled.
~dispose arranges for automatic cleanup of the terminal before the process terminates. The downside is that a reference to this terminal is retained until the program exits. Defaults to true.
~nosig additionally turns off signal delivery and flow control (isig and ixon) on input. Inhibits automatic handling of CTRL-{C,Z,\,S,Q}. Defaults to true.
~mouse activates mouse reporting. Defaults to true.
~bpaste activates bracketed paste reporting. Defaults to true.
~input is the input file descriptor. Defaults to stdin.
~output is the output file descriptor. Defaults to stdout.
Dispose of this terminal. Original behavior of input fd is reinstated, cursor is restored, mouse reporting disabled, and alternate mode is terminated.
It is an error to use the commands on a released terminal, and will raise Invalid_argument, while release itself is idempotent.
Commands
image t i sets i as t's current image and redraws the terminal.
refresh t redraws the terminal using the current image.
Useful if the output might have become garbled.
cursor t pos sets and redraws the cursor.
None hides it. Some (x, y) places it at column x and row y, with the origin at (0, 0), mapping to the upper-left corner.
Events
Wait for a new event. event t can be:
#Unescape.event, aneventfrom the input fd;`Endif the input fd is closed, or the terminal was released; or`Resize (cols, rows)giving the current size of the output tty, if aSIGWINCHwas delivered before or during this call toevent.
Note event is buffered. Calls can either block or immediately return. Use pending to detect when the next call would not block.
pending t is true if the next call to event would not block and the terminal has not yet been released.
Properties
fds t are t's input and output file descriptors.