diff options
| author | sl0p <sl0p@sl0p.foo> | 2026-08-13 22:08:30 +0200 |
|---|---|---|
| committer | sl0p <sl0p@sl0p.foo> | 2026-08-13 22:08:30 +0200 |
| commit | 7521f217a5ed98cef16db5837a72fae32dce9552 (patch) | |
| tree | 396837adb0cd65066d78f32eb3b6a9de7eabf67a /Makefile | |
| parent | sl0ptty: M0 — libghostty-vt vendored, one pane, compositor, diff renderer (diff) | |
| download | slosh-7521f217a5ed98cef16db5837a72fae32dce9552.tar.gz slosh-7521f217a5ed98cef16db5837a72fae32dce9552.tar.xz slosh-7521f217a5ed98cef16db5837a72fae32dce9552.zip | |
sl0ptty: input decoder + per-pane re-encode
The half libghostty-vt does not do: decode what the outer terminal sends us
into semantic events, then re-encode each event for the target pane against
that pane's own negotiated modes.
Decoder (src/input.c): legacy keys and modifiers, SS3, tilde keys, the kitty
keyboard protocol (CSI u, shifted/base layout sub-params, press/repeat/release,
associated text), SGR mouse incl. drag and wheel, bracketed paste, focus
events, alt-prefix, UTF-8, and partial sequences retained across reads.
Re-encoding (pane_send_key/mouse/paste) drives lib-vt's key and mouse encoders
via setopt_from_terminal, so a pane gets exactly what it negotiated. The mouse
encoder wants surface pixels; we declare a 1x1 pixel cell so cell coordinates
are exact rather than approximated.
The prefix key is handled on decoded events, not bytes, so it cannot be
confused by a byte that merely looks like C-a inside a UTF-8 or escape
sequence.
Tests: 40 table-driven decoder cases (tests/input_test.c) + a live check that
drives the same client into a legacy pane and a kitty/mouse pane and asserts
each receives its own encoding (tests/live_input.py). 59 checks, all green.
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -41,8 +41,17 @@ $(VT_LIB): vendor: ## build the vendored libghostty-vt (needs zig 0.16) cd $(VT) && PATH="$(dir $(ZIG)):$$PATH" zig build -Demit-lib-vt -Doptimize=ReleaseFast -test: $(BIN) ## run the live pty checks +TEST_BIN := build/input_test + +$(TEST_BIN): tests/input_test.c src/input.c $(VT_LIB) | build + $(CC) $(CFLAGS) tests/input_test.c src/input.c $(VT_LIB) -o $@ + +test: $(BIN) $(TEST_BIN) ## run unit + live checks + ./$(TEST_BIN) + @echo python3 tests/live_m0.py + @echo + python3 tests/live_input.py smoke: $(BIN) ## compose a screen headlessly and print it ./$(BIN) --headless --cols 40 --rows 6 -- /bin/sh -c 'printf "hello \033[1;32msl0ptty\033[0m\n"; echo "wide: 日本語"' |
