class
Termisu::Termios
- Termisu::Termios
- Reference
- Object
Overview
Manages terminal attributes for raw mode operation.
Raw mode disables:
- Input processing (IGNBRK, BRKINT, PARMRK, ISTRIP, INLCR, IGNCR, ICRNL, IXON)
- Echo and canonical mode (ECHO, ECHONL, ICANON, ISIG, IEXTEN)
- Parity checking, sets 8-bit characters (CS8)
Defined in:
termisu/termios.crConstructors
-
.new(fd : Int32)
Creates a new Termios instance for the given file descriptor.
Instance Method Summary
-
#enable_raw_mode
Enables raw mode on the terminal.
-
#restore
Restores original terminal attributes saved during enable_raw_mode.
Constructor Detail
def self.new(fd : Int32)
#
Creates a new Termios instance for the given file descriptor.
Parameters:
- fd: File descriptor (typically STDIN.fd for terminal input)
Instance Method Detail
def enable_raw_mode
#
Enables raw mode on the terminal.
Saves current attributes and modifies terminal to disable:
- Input processing and special character handling
- Echo of typed characters
- Canonical (line-buffered) mode
- Signal generation from Ctrl+C, Ctrl+Z, etc.
def restore
#
Restores original terminal attributes saved during enable_raw_mode.
Safe to call even if enable_raw_mode was never called (no-op).