Quartz::TUI::Screen
Raw-mode terminal abstraction.
Pure-stdlib, Unix-only. Uses LibC::Termios to flip the controlling terminal into cbreak/no-echo mode, and emits plain ANSI/VT escapes to drive the alt screen, cursor, and cells. Non-tty IO (IO::Memory) is fully supported for tests — termios is only touched when the input is a real tty.
Constants
CLEAR_SCREEN = "\e[2J"
CURSOR_HOME = "\e[H"
DEFAULT_COLS = 80
DEFAULT_ROWS = 24
ENTER_ALT = "\e[?1049h"
ESC = "\e["
ANSI constants — kept in one place so specs can assert on them.
HIDE_CURSOR = "\e[?25l"
LEAVE_ALT = "\e[?1049l"
PRINTABLE_SYMBOLS = {32_u8 => :char_space, 65_u8 => :char_A, 66_u8 => :char_B, 67_u8 => :char_C, 68_u8 => :char_D, 69_u8 => :char_E, 70_u8 => :char_F, 71_u8 => :char_G, 72_u8 => :char_H, 73_u8 => :char_I, 74_u8 => :char_J, 75_u8 => :char_K, 76_u8 => :char_L, 77_u8 => :char_M, 78_u8 => :char_N, 79_u8 => :char_O, 80_u8 => :char_P, 82_u8 => :char_R, 83_u8 => :char_S, 84_u8 => :char_T, 85_u8 => :char_U, 86_u8 => :char_V, 87_u8 => :char_W, 88_u8 => :char_X, 89_u8 => :char_Y, 90_u8 => :char_Z, 97_u8 => :char_a, 98_u8 => :char_b, 99_u8 => :char_c, 100_u8 => :char_d, 101_u8 => :char_e, 102_u8 => :char_f, 103_u8 => :char_g, 104_u8 => :char_h, 105_u8 => :char_i, 106_u8 => :char_j, 107_u8 => :char_k, 108_u8 => :char_l, 109_u8 => :char_m, 110_u8 => :char_n, 111_u8 => :char_o, 112_u8 => :char_p, 114_u8 => :char_r, 115_u8 => :char_s, 116_u8 => :char_t, 117_u8 => :char_u, 118_u8 => :char_v, 119_u8 => :char_w, 120_u8 => :char_x, 121_u8 => :char_y, 122_u8 => :char_z} of UInt8 => Symbol
Static byte -> symbol table for printable keys we care about.
READ_TIMEOUT_MS = 50
RESET_ATTR = "\e[0m"
SHOW_CURSOR = "\e[?25h"
Constructors
Instance methods
alt?
Sourceclear
Sourceflush
Sourceio_in
Sourceio_out
Sourceraw?
Sourceread_key
Read a single keypress, with a short blocking window. Returns :up/:down/:left/:right/:enter/:esc/:q/:char_<c>/:unknown. Returns :timeout if no byte arrived within READ_TIMEOUT_MS.
size
Sourcewith_session
Source