/* Terminal control for the history view. * * The view needs three things V's standard library does not expose directly: * raw mode with the terminal restored on exit, the window size, and one * keystroke at a time with escape sequences kept together. Keeping this in C * means one implementation for macOS and Linux, and no termios struct layout * in V. */ #ifndef KOH_TERM_H #define KOH_TERM_H /* Switches stdin to raw mode (enable = 1) or back (enable = 0). Returns 1 on * success. Ctrl-C is delivered as a key rather than a signal, so the caller * can restore the terminal before quitting. */ int koh_term_raw(int enable); /* Fills rows and columns; falls back to 24x80 when the size is unavailable. */ int koh_term_size(int *rows, int *cols); /* Reads one keystroke into buf, gathering the rest of an escape sequence when * the first byte is ESC. Returns the byte count, or 0 at end of input. */ int koh_read_key(char *buf, int cap); #endif