Repository navigation
v0.10.0
szn v0.10.0
62 commits since v0.9.1. 1,032 tests passing.
Headline: Hot-Path Performance Architecture, VS16 Emoji Promotion, Hardened Sixel Engine, and 61-Bug Stability Sweep
v0.10.0 is a milestone release delivering substantial performance improvements across terminal input processing and rendering pipelines, introducing configurable Unicode Variation Selector 16 (VS16) emoji presentation width control, hardening the Sixel graphics engine with transactional lifecycle guarantees, and resolving 61 bug tracker entries (#441–#501) across memory safety, IPC protocol validation, process lifecycles, and terminal emulation fidelity.
Key Improvements & Features
1. Hot-Path Performance Architecture (#476, #478–#483)
-
Chunked Input Parser Dispatch (
advanceBatch): Replaced byte-by-byte virtual method dispatch loops inInputParserwith a vectorized batching scanner (advanceBatch). Contiguous runs of printable ASCII characters are scanned in a tight loop and written directly to the screen grid in single operations, dramatically reducing dispatch overhead during heavy terminal output (e.g.cat, compiler logs,find). -
Fast-Path ASCII Streaming: Optimized
Screen.writeStrto stream uninterrupted ASCII byte runs directly into grid cells without per-codepoint decoding or branch evaluation. -
O(1) Pane Validity & Tree-Walk Elimination: Replaced expensive recursive layout tree traversals on every terminal output chunk with an
$O(1)$ pane liveness bit (isPaneValid), eliminating CPU bottlenecks when running multiple active panes. - Batched Render Frames & SGR Generation: Replaced per-space writes and cell-by-cell escape formatting with contiguous run-length writes and pre-buffered frame chunks, reducing system calls and IPC payload overhead during screen repainting.
- Arena-Backed Format Buffering: Replaced heap allocations during status bar and format string expansion with reusable arena allocations.
2. Unicode VS16 Emoji Presentation Width Option
variation-selector-always-wideConfiguration: Added thevariation-selector-always-wideboolean option (default:off), configurable via~/.szn.conforset-option -g variation-selector-always-wide on.- VS16 Promotion Support: When enabled, single-width base characters followed by Unicode Variation Selector 16 (
U+FE0F) are promoted to 2 cells with a dedicated padding cell, matching modern terminals (e.g. Kitty, Alacritty) that expand emoji presentation sequences. - Full Engine Synchronization: Synchronized width promotion across
Screen.writeChar, status measurement, copy mode selection, and TTY output rendering.
3. Sixel Graphics Subsystem Hardening (#454, #464, #473, #491–#493, #501)
- Strict Containment Verification: Replaced unchecked pixel dimension math with saturating ceiling division. Images exceeding pane cell boundaries are discarded early to avoid spurious grid scrolling and display corruption (#464).
- Scroll-Region Bound Anchor Shifting: Constrained
shiftSixelAnchorsto only adjust images intersecting active scroll regions (DECSTBM), preventing off-region graphics from drifting during partial scrollback (#492). - Marker Cell Purging (
clearSixelMarkerCells): Erasing screen areas (ED 0,ED 1,ED 2) explicitly purges surviving sixel marker cells so stale IDs do not linger across screen repaints (#493). - Transactional Placement Contract & Zero-Leak Rollback:
placeSixelImagetakes strict ownership of DCS byte buffers; on any allocation failure or scroll error, image memory is immediately freed, refcounts and slot pointers are zeroed, and any partially-written marker cells are rolled back (#501). - Refcount Preservation on Emoji Promotion: Preserved sixel image refcounts when base cells are promoted or modified by subsequent VS16 wide characters (#491).
4. Memory Safety, Pointer Stability, & IPC Integrity (#448–#450, #455, #458, #459, #471, #472, #475, #490, #496, #499)
- Stable Display Client Pointer Lifetimes: Converted server
display_clientstoArrayList(*DisplayClient), ensuring pointer stability across dynamic client connections, disconnections, and list resizes (#450). - Bounded OSC 52 Clipboard Handling: Capped OSC 52 clipboard sequence buffers at 1 MiB to prevent heap exhaustion and denial-of-service from rogue inner applications (#490).
- Wire Message Dimension Clamping: Validated and clamped
cell_sizepixel dimensions to valid ranges ([1, 1024]), rejecting corrupt or malicious packets from crashing the server (#496). - Command Output Buffer Bounds: Prevented oversized command response payloads from killing attached display clients (#475).
- Allocator Ownership Clarification: Removed redundant allocator arguments from
InputParser.deinit, ensuring internal DCS/OSC buffers are freed usingscreen.allocatorconsistently without risking cross-allocator heap corruption (#499). - History Ring Shrink Hardening: Blanked freed history line pointers on ring reduction so subsequent OOM conditions cannot trigger double-free crashes (#455).
5. Terminal Emulation, Key Handling & Process Lifecycle (#486, #487, #489, #495, #498, #500)
- Race-Free Process Reaping:
Pty.deinitreaps child processes before issuingSIGKILL, eliminating PID-reuse race conditions and avoiding zombie processes (#486). - Daemon Stdio Redirection: Daemon fork children safely redirect standard descriptors (0, 1, 2) to
/dev/nullwithout double-closing descriptor 0 (#487). - Kitty Keyboard Protocol Release Filtering: Discarded Kitty extended keyboard release events (
:3) to prevent accidental double-inputs in TUIs (#489). - Raw Mode Failure Diagnostics: Interactive client startup reports explicit diagnostic errors and exits with non-zero status if setting raw terminal mode fails (#498).
- Full-Height Rendering Without Status Bar: Fixed
renderContentto render up to full terminal height (h = @min(screen.grid.height, self.sy)) when the status bar is disabled (#495). - Non-SGR Attribute Masking: Masked out internal non-SGR marker bits in
Term.setAttributesto prevent bare escape resets and color cache desynchronization (#500).
Testing & Quality Assurance
| Metric | v0.9.0 | v0.9.1 | v0.10.0 |
|---|---|---|---|
| Total Passing Tests | 959 | 970 | 1,032 |
| New Regression Tests | — | 11 | 62 |
| Open Bugs in Tracker | 0 | 0 | 0 |
| Bugs Resolved in Cycle | 44 (#395–#439) | 1 (#440) | 61 (#441–#501) |
| Build Status | All passing | All passing | Clean under Zig 0.16.0 (Debug, ReleaseSafe, ReleaseFast) |