Applies parser events to a grid: the terminal's actual behaviour.
The emulator holds everything a program can observe about the screen: cursor, styles, scroll region, modes, tab stops, scrollback, and title. Feed it bytes, read the grid.
Row and column indices are zero-based throughout, including cursor/1, even
though the escape sequences that set them are one-based.
Damage is the set of rows whose content changed since the last clear_damage/1.
Summary
Functions
True while the alternate screen is in use.
Forget which rows are dirty, after painting them.
True once the program has erased the whole display.
The cursor position as {row, col}, zero-based.
True unless the program has hidden the cursor.
Rows whose content changed since the last clear_damage/1.
Feed bytes to the terminal.
True when the program has been painting a screen rather than printing output.
The visible grid.
Whether a mode the program can set is currently on.
A blank terminal.
Resize the terminal.
Rows that have scrolled off the top of the primary screen.
How many rows that scrolled off the top are still held.
The style subsequent text will be written with.
The window title last set by OSC 0 or OSC 2.
How many rows of the screen the program has written.
Types
@type mode() ::
:autowrap
| :cursor_visible
| :origin
| :insert
| :bracketed_paste
| :focus_events
| :app_cursor_keys
| :app_keypad
| :mouse_x10
| :mouse_normal
| :mouse_buttons
| :mouse_any
| :mouse_sgr
| :mouse_utf8
@type t() :: %ETee.Emulator{ alt_screen?: term(), cleared?: term(), cursor: term(), damage: term(), grid: term(), modes: term(), parser: term(), pending_wrap: term(), saved_cursor: term(), saved_grid: term(), scroll_bottom: term(), scroll_top: term(), scrollback: term(), style: term(), tabs: term(), title: term() }
Functions
True while the alternate screen is in use.
Forget which rows are dirty, after painting them.
True once the program has erased the whole display.
@spec cursor(t()) :: {non_neg_integer(), non_neg_integer()}
The cursor position as {row, col}, zero-based.
True unless the program has hidden the cursor.
@spec damage(t()) :: MapSet.t(non_neg_integer())
Rows whose content changed since the last clear_damage/1.
Operations touching the whole screen are recorded as such; the set is materialised on this call.
Feed bytes to the terminal.
True when the program has been painting a screen rather than printing output.
True while the alternate screen is in use, and true once the whole display has been
erased provided scrolled/1 is still zero. Anything scrolling off the top makes it
false again.
@spec grid(t()) :: ETee.Grid.t()
The visible grid.
Whether a mode the program can set is currently on.
@spec new(pos_integer(), pos_integer(), keyword()) :: t()
A blank terminal.
Options:
:scrollback— rows of history to retain, default 1000
@spec resize(t(), pos_integer(), pos_integer()) :: t()
Resize the terminal.
The cursor is clamped into the new bounds and a scroll region that no longer fits is reset to the full screen.
@spec scrollback(t()) :: ETee.Scrollback.t()
Rows that have scrolled off the top of the primary screen.
@spec scrolled(t()) :: non_neg_integer()
How many rows that scrolled off the top are still held.
Bounded by the :scrollback limit given to new/3: rows dropped past that limit are
not counted. Rows evicted while the alternate screen is in use are never captured.
@spec style(t()) :: ETee.Style.t()
The style subsequent text will be written with.
The window title last set by OSC 0 or OSC 2.
@spec used_rows(t()) :: pos_integer()
How many rows of the screen the program has written.
Once anything has scrolled off the top this is the full row count. Otherwise it is the cursor row plus one, capped at the row count.