Functions
raw_mode
1
Generator[None]
▼
Context manager that puts the terminal into raw mode.
Restores original settin…
raw_mode
1
Generator[None]
▼
def raw_mode(fd: int | None = None) -> Generator[None]
Context manager that puts the terminal into raw mode.
Restores original settings on exit.
Parameters
| Name | Type | Description |
|---|---|---|
fd |
int | None |
Default:None
|
Returns
Generator[None]
read_char
1
str
▼
Read a single character from the terminal.
Must be called within a raw_mode() …
read_char
1
str
▼
def read_char(fd: int | None = None) -> str
Read a single character from the terminal.
Must be called within a raw_mode() context.
Parameters
| Name | Type | Description |
|---|---|---|
fd |
int | None |
Default:None
|
Returns
str
read_available
2
str
▼
Read all immediately available bytes (non-blocking).
Used to consume multi-byt…
read_available
2
str
▼
def read_available(fd: int | None = None, max_bytes: int = 16) -> str
Read all immediately available bytes (non-blocking).
Used to consume multi-byte escape sequences after the initial escape.
Parameters
| Name | Type | Description |
|---|---|---|
fd |
int | None |
Default:None
|
max_bytes |
int |
Default:16
|
Returns
str
is_tty
1
bool
▼
Check if fd is connected to a terminal.
is_tty
1
bool
▼
def is_tty(fd: int | None = None) -> bool
Parameters
| Name | Type | Description |
|---|---|---|
fd |
int | None |
Default:None
|
Returns
bool