package terml

  1. Overview
  2. Docs

Module Terml.TerminalSource

Sourceval stdin_fd : Unix.file_descr
Sourcetype clear_type =
  1. | All
  2. | Purge
  3. | FromCursorDown
  4. | FromCursorUp
  5. | CurrentLine
  6. | UntilNewLine
Sourcetype t =
  1. | DisableLineWrap
  2. | EnableLineWrap
  3. | EnterAlternateScreen
  4. | LeaveAlternateScreen
  5. | ScrollUp of int
  6. | ScrollDown of int
  7. | SetSize of int * int
  8. | SetTitle of string
  9. | BeginSyncUpdate
  10. | EndSyncUpdate
  11. | ClearScreen of clear_type
Sourcetype window_size = {
  1. rows : int;
  2. cols : int;
  3. width : int;
  4. height : int;
}
Sourceval disable_line_wrap : string

Disables line wrapping.

Sourceval enable_line_wrap : string

Enables line wrapping.

Sourceval enter_alternate_screen : string

A command that switches to the alternate screen buffer.

Sourceval leave_alternate_screen : string

A command that switches back from the alternate screen buffer.

Sourceval scroll_up : int -> string

A command that scrolls the terminal up a given number of rows.

Sourceval scroll_down : int -> string

A command that scrolls the terminal down a given number of rows.

Sourceval set_size : int -> int -> string

A command that sets the terminal buffer size (columns, rows).

Sourceval set_title : string -> string

A command that sets the terminal title.

Sourceval begin_sync_update : string

A command that tells the terminal to begin a synchronous update.

Terminal emulators usually iterates through each grid cell in the visible screen and renders its current state. Applications that updates the screen at a higher frequency can experience tearing.

When a synchronous update is enabled, the terminal will keep rendering the previous frame until the application is ready to render the next frame.

Disabling synchronous update will cause the terminal to render the screen as soon as possible.

Sourceval end_sync_update : string

A command that tells the terminal to end a synchronous update.

Terminal emulators usually iterates through each grid cell in the visible screen and renders its current state. Applications that updates the screen at a higher frequency can experience tearing.

When a synchronous update is enabled, the terminal will keep rendering the previous frame until the application is ready to render the next frame.

Disabling synchronous update will cause the terminal to render the screen as soon as possible.

Sourceval clear_screen : clear_type -> string

A command that clears the terminal screen buffer. clear_type specifies the type of clear to perform.

  • All clears the entire screen.
  • Purge clears the entire screen and the scrollback buffer. (history)
  • FromCursorDown clears from the cursor to the end of the screen.
  • FromCursorUp clears from the cursor to the beginning of the screen.
  • CurrentLine clears the current line.
  • UntilNewLine clears from the cursor until the new line.
Sourceval enable_raw_mode : unit -> Unix.terminal_io

Enable raw mode for the current terminal. Returns the previous terminal settings so that they can be restored later.

Sourceval disable_raw_mode : Unix.terminal_io -> unit

Disables raw mode for the current terminal. termios is the terminal settings that were previously saved by enable_raw_mode.

Sourceval execute : t -> string