code wiki / (root) / nx_input.nx

nx_input.nx

buildroot/runtime/nx_input.nx

5148 B133 linesdepth 4pulls 5 transitivereach 0 importersview sourcekind orphan librarytopic input
docsdependenciesstructsconstsfunctions

about

nx_input.nx -- terminal input primitives (line + byte read from stdin). The user-interaction layer's INPUT side. Reads bytes from stdin (fd=0) via sys_read; decodes basic escape sequences when in raw mode (see nx_termios.nx for raw-mode entry). Companion to nx_tty.nx (output side). Together they close the substrate-to-user gap. Why this exists (per user 2026-05-13): user said "if not build it" when the layer audit showed UI was the missing tier. This is the foundation; widgets / event loop can build on these primitives. Standard usage: - nx_input_read_line(buf, max) -- cooked-mode line read - nx_input_read_byte() -- single byte (works in any mode) - nx_input_read_key() -- decode arrow keys etc. (raw mode) genealogy_id: ecma_48_1976_ansi_escape + readline_lineage lineage_id: stdin_byte_stream + escape_sequence_decode axioms: NX_AX_LOGIC_EXCLUDED_MIDDLE (each byte is or isn't a key event prefix; no third state)

dependencies 3 imports · 0 importers

syscalls.nx runtime.nx nx_axioms.nx nx_input.nx

imports: syscalls.nxruntime.nxnx_axioms.nx

imported by: nobody (leaf or entry point)

structs

none

consts

37const NX_KEY_NONE: i64 = 0
38const NX_KEY_BACKSPACE: i64 = 127
39const NX_KEY_ENTER: i64 = 10
40const NX_KEY_ESC: i64 = 27
41const NX_KEY_UP: i64 = 1001
42const NX_KEY_DOWN: i64 = 1002
43const NX_KEY_RIGHT: i64 = 1003
44const NX_KEY_LEFT: i64 = 1004
45const NX_KEY_HOME: i64 = 1005
46const NX_KEY_END: i64 = 1006
47const NX_KEY_PGUP: i64 = 1007
48const NX_KEY_PGDN: i64 = 1008
49const NX_KEY_DEL: i64 = 1009
50const NX_KEY_INS: i64 = 1010

functions

54func nx_input_read_byte() -> i64
65func nx_input_read_line(buf: *u8, max: i64) -> i64
102func nx_input_read_key() -> i64