|
ze
|

Files | |
| file | terminal.c |
| Raw terminal mode helpers and key decoding. | |
Functions | |
| void | die (const char *s) |
| Abort the program after resetting the screen and printing perror. | |
| void | disableRawMode (void) |
| Restore cooked terminal mode. | |
| void | enableRawMode (void) |
| Enable raw terminal mode and register an atexit handler. | |
| char | editorReadKey (void) |
Read a key, decoding escape sequences into editorKey values. | |
| int | getCursorPosition (int *rows, int *cols) |
| Query the terminal for the current cursor position. | |
| int | getWindowSize (int *rows, int *cols) |
| Obtain terminal window size in rows and columns. | |
| void die | ( | const char * | s | ) |
Abort the program after resetting the screen and printing perror.
Clears the screen, moves the cursor home, prints a perror() message for s, and exits with code 1.
| [in] | s | Message passed to perror(). Must be a NUL-terminated string. |
| void disableRawMode | ( | void | ) |
Restore cooked terminal mode.
Restores original termios captured in E.orig_termios. On failure, calls die().
| char editorReadKey | ( | void | ) |
Read a key, decoding escape sequences into editorKey values.
Blocks until one byte is read; if the byte begins an escape sequence, attempts to parse known sequences into control codes.
| void enableRawMode | ( | void | ) |
Enable raw terminal mode and register an atexit handler.
Captures current termios into E.orig_termios, registers atexit handler to restore it, and configures raw input/output settings.
| int getCursorPosition | ( | int * | rows, |
| int * | cols | ||
| ) |
Query the terminal for the current cursor position.
Sends CSI 6n and parses the response.
| [out] | rows | Receives 1-based row number. |
| [out] | cols | Receives 1-based column number. |
| int getWindowSize | ( | int * | rows, |
| int * | cols | ||
| ) |
Obtain terminal window size in rows and columns.
Uses ioctl(TIOCGWINSZ) and falls back to cursor probing if needed.
| [out] | rows | Receives number of rows. |
| [out] | cols | Receives number of columns. |