aboutsummaryrefslogtreecommitdiff
path: root/vendor/libghostty-vt/src/terminal/Parser.zig
diff options
context:
space:
mode:
authorCan Celik <ogulcancelik@gmail.com>2026-09-10 21:51:57 +0300
committerGitHub <noreply@github.com>2026-09-10 21:51:57 +0300
commit425c86179791cd32e2d4ce0ae7f269940b4b0663 (patch)
treee52c4383a6d69216cbe2a32638bf90841d7e2189 /vendor/libghostty-vt/src/terminal/Parser.zig
parent90e947a6e26e02f10ec7f1694c4eb5b78a86406b (diff)
chore: upgrade libghostty and preserve terminal behavior (#3906)
Diffstat (limited to 'vendor/libghostty-vt/src/terminal/Parser.zig')
-rw-r--r--vendor/libghostty-vt/src/terminal/Parser.zig29
1 files changed, 23 insertions, 6 deletions
diff --git a/vendor/libghostty-vt/src/terminal/Parser.zig b/vendor/libghostty-vt/src/terminal/Parser.zig
index 88e7edf7..34e7e30f 100644
--- a/vendor/libghostty-vt/src/terminal/Parser.zig
+++ b/vendor/libghostty-vt/src/terminal/Parser.zig
@@ -166,12 +166,18 @@ pub const Action = union(enum) {
// of invisible characters we don't want to handle right
// now.
- // All others do the default behavior
+ // All others do the default behavior. Note the max
+ // depth of 1: this is only used for logging so we
+ // only want the top-level fields. Larger depths
+ // instantiate a recursive formatter for every nested
+ // type of every action payload (e.g. the full
+ // osc.Command union), which costs tens of kilobytes
+ // of binary size.
else => try writer.printValue(
"any",
.{},
@field(self, u_field.name),
- 3,
+ 1,
),
}
}
@@ -386,10 +392,7 @@ inline fn doAction(self: *Parser, action: TransitionAction, c: u8) ?Action {
// We only allow colon or mixed separators for the 'm' command.
if (c != 'm' and self.params_sep.count() > 0) {
@branchHint(.cold);
- log.warn(
- "CSI colon or mixed separators only allowed for 'm' command, got: {f}",
- .{result},
- );
+ warnCsiSepMismatch(result.csi_dispatch);
break :csi_dispatch null;
}
@@ -406,6 +409,20 @@ inline fn doAction(self: *Parser, action: TransitionAction, c: u8) ?Action {
};
}
+/// Log a warning for a CSI dispatch with colon/mixed separators on a
+/// non-'m' command.
+///
+/// This is noinline on purpose so that this unlikely (cold) behavior
+/// doesn't bloat the hot dispatch path which has been measured to actually
+/// affect both binary size and performance due to icache busts.
+noinline fn warnCsiSepMismatch(csi: Action.CSI) void {
+ @branchHint(.cold);
+ log.warn(
+ "CSI colon or mixed separators only allowed for 'm' command, got: {f}",
+ .{csi},
+ );
+}
+
pub inline fn clear(self: *Parser) void {
self.intermediates_idx = 0;
self.params_idx = 0;