ANSI escape sequence generation.
Converts Buffer cells and diffs into terminal escape sequences. Pure module — no side effects. All functions return iodata.
Summary
Functions
Begin synchronized update — terminal buffers output until end_sync_update.
Generate OSC 52 sequence to copy text to the system clipboard.
Default Kitty keyboard flags: disambiguate (1) + alternate keys (4) = 5.
Disable xterm modifyOtherKeys mode.
Enable xterm modifyOtherKeys mode 2 (fallback for non-Kitty terminals).
End synchronized update — terminal flushes buffered output.
Build a complete frame output: hide cursor, render, show cursor.
Move cursor to (x, y). 1-indexed for ANSI.
Pop Kitty keyboard flags from the terminal's stack.
Push Kitty keyboard flags onto the terminal's stack.
Query DECRQM for a private mode. Response: \e[?{mode};{status}$y
Query current Kitty keyboard flags. Terminal responds with \e[?{flags}u.
Render only the diff changes between two buffers.
Render an entire buffer to ANSI iodata (for initial draw or full redraw).
Set the Kitty keyboard flags for the current top-of-stack entry (no push/pop).
Generate SGR sequence from a cell map.
Generate SGR (Select Graphic Rendition) sequence for a cell's style.
Functions
@spec begin_sync_update() :: iodata()
Begin synchronized update — terminal buffers output until end_sync_update.
@spec clear_line() :: iodata()
@spec clear_screen() :: iodata()
Generate OSC 52 sequence to copy text to the system clipboard.
The terminal intercepts this sequence and copies the decoded text. Uses BEL (\a) terminator — more compatible than ST (\e\) which breaks in screen and older tmux versions.
@spec default_kitty_flags() :: non_neg_integer()
Default Kitty keyboard flags: disambiguate (1) + alternate keys (4) = 5.
@spec disable_modify_other_keys() :: iodata()
Disable xterm modifyOtherKeys mode.
@spec disable_mouse() :: iodata()
@spec disable_paste() :: iodata()
@spec enable_modify_other_keys() :: iodata()
Enable xterm modifyOtherKeys mode 2 (fallback for non-Kitty terminals).
@spec enable_mouse() :: iodata()
@spec enable_paste() :: iodata()
@spec end_sync_update() :: iodata()
End synchronized update — terminal flushes buffered output.
@spec enter_alt_screen() :: iodata()
Build a complete frame output: hide cursor, render, show cursor.
@spec hide_cursor() :: iodata()
@spec leave_alt_screen() :: iodata()
@spec move_to(non_neg_integer(), non_neg_integer()) :: iodata()
Move cursor to (x, y). 1-indexed for ANSI.
@spec pop_kitty_keyboard() :: iodata()
Pop Kitty keyboard flags from the terminal's stack.
@spec push_kitty_keyboard(non_neg_integer()) :: iodata()
Push Kitty keyboard flags onto the terminal's stack.
@spec query_decrqm(non_neg_integer()) :: iodata()
Query DECRQM for a private mode. Response: \e[?{mode};{status}$y
@spec query_kitty_keyboard() :: iodata()
Query current Kitty keyboard flags. Terminal responds with \e[?{flags}u.
@spec render_diff([ {non_neg_integer(), non_neg_integer(), ElixirOpentui.Buffer.cell()} ]) :: iodata()
Render only the diff changes between two buffers.
@spec render_full(ElixirOpentui.Buffer.t()) :: iodata()
Render an entire buffer to ANSI iodata (for initial draw or full redraw).
@spec reset() :: iodata()
@spec set_kitty_keyboard(non_neg_integer()) :: iodata()
Set the Kitty keyboard flags for the current top-of-stack entry (no push/pop).
\e[={flags}u replaces the current entry's flags directly. Sending
set_kitty_keyboard(0) before pop_kitty_keyboard() ensures keyboard
enhancements are disabled even if the pop doesn't take effect.
Generate SGR sequence from a cell map.
@spec sgr( ElixirOpentui.Color.t(), ElixirOpentui.Color.t(), boolean(), boolean(), boolean(), boolean(), boolean(), boolean(), boolean(), boolean() ) :: iodata()
Generate SGR (Select Graphic Rendition) sequence for a cell's style.
@spec show_cursor() :: iodata()