mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-08-04 06:38:37 +00:00
terminal: add standalone LZ4 block codec
Scrollback compression needs a codec that can be used from libghostty-vt without pulling in libc, and we need to measure it before integrating it with terminal page ownership. This adds an allocation-free raw LZ4 block codec in scalar Zig. Callers provide the input, output, and fixed-size scratch table. The decoder uses an exact-size output contract so page metadata mismatches fail cleanly. Compatibility vectors, boundary cases, random round trips, and fuzz coverage exercise the block format. Also adds a page-compression benchmark that operates on reusable raw page corpora. Compression and decompression have separate modes with setup outside the timed region, plus a ratio report and no-op baseline. Nothing uses compression in the terminal yet; this is the isolated codec and measurement groundwork.
This commit is contained in:
@@ -8,6 +8,7 @@ const cli = @import("../cli.zig");
|
||||
pub const Action = enum {
|
||||
@"codepoint-width",
|
||||
@"grapheme-break",
|
||||
@"page-compression",
|
||||
@"screen-clone",
|
||||
@"terminal-parser",
|
||||
@"terminal-stream",
|
||||
@@ -25,6 +26,7 @@ pub const Action = enum {
|
||||
pub fn Struct(comptime action: Action) type {
|
||||
return switch (action) {
|
||||
.@"screen-clone" => @import("ScreenClone.zig"),
|
||||
.@"page-compression" => @import("PageCompression.zig"),
|
||||
.@"terminal-stream" => @import("TerminalStream.zig"),
|
||||
.@"codepoint-width" => @import("CodepointWidth.zig"),
|
||||
.@"grapheme-break" => @import("GraphemeBreak.zig"),
|
||||
|
||||
Reference in New Issue
Block a user