Module terminal

Module terminal 

Source
Expand description

Terminal Operations for Seq

These functions provide low-level terminal control for building interactive applications (vim-style editors, menus, etc.).

§Platform Support

These functions are Unix-only (they use POSIX termios). On non-TTY file descriptors, operations gracefully degrade (raw mode is a no-op, size returns defaults).

§Thread Safety

Terminal operations are not thread-safe and should only be called from the main thread. This is standard for TUI applications - terminal state is global to the process.

§Signal Safety

When raw mode is enabled, signal handlers are installed for SIGINT and SIGTERM that restore terminal state before the process exits. This ensures the terminal isn’t left in a broken state if the program is killed.

§Safety Contract

These functions are designed to be called ONLY by compiler-generated code. The compiler is responsible for ensuring correct stack types.

Re-exports§

pub use patch_seq_terminal_flush as terminal_flush;
pub use patch_seq_terminal_height as terminal_height;
pub use patch_seq_terminal_raw_mode as terminal_raw_mode;
pub use patch_seq_terminal_read_char as terminal_read_char;
pub use patch_seq_terminal_read_char_nonblock as terminal_read_char_nonblock;
pub use patch_seq_terminal_width as terminal_width;

Functions§

patch_seq_terminal_flush
Flush stdout
patch_seq_terminal_height
Get terminal height (rows)
patch_seq_terminal_raw_mode
Enable or disable raw terminal mode
patch_seq_terminal_read_char
Read a single character from stdin (blocking)
patch_seq_terminal_read_char_nonblock
Read a single character from stdin (non-blocking)
patch_seq_terminal_width
Get terminal width (columns)