feat(vt): port the stream layer between parser and handlers
Ports ZIG/src/terminal/stream.zig: the Stream feeds bytes through the UTF-8 decoder and parser and dispatches every CSI/ESC/OSC/DCS/APC and C0/C1 control to a Handler as a high-level Action (all 95 Zig variants). Zig's comptime handler interface becomes a Handler trait with an associated error type, a required vt() and an optional vt_raw() hook. Performance: next_slice() processes 4 KiB chunks, finds ESC with memchr and decodes printable runs in bulk (scalar port of ZIG/src/simd's index_of / utf8_decode_until_control_seq), plus the CSI parameter fast path. Terminals must construct the stream with Stream::new_alloc so the OSC parser accepts allocating commands (colors, OSC 133), as in Zig. Minor differences: after a stray UTF-8 byte the rest of the chunk returns to the fast path, and a spurious Zig warning after CSI 2/5 W is dropped. Test Plan: - cargo test -p ghostty-vt (448 passed; 37/38 stream tests ported, the skipped one only exercises the C ABI)
This commit is contained in:
1 parent
3afe938b95
commit
800fe5be5e
7 files changed
+2635
-6
No files matched your search
@@ -7,6 +7,7 @@ license.workspace = true
|
||||
[dependencies]
|
||||
base64 = "0.23.1"
|
||||
log = "0.4.34"
|
||||
memchr = "2.8.3"
|
||||
thiserror = "2.0.21"
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user