summaryrefslogtreecommitdiff
path: root/src/inspector
diff options
context:
space:
mode:
authorMitchell Hashimoto <m@mitchellh.com>2025-09-28 14:55:15 -0700
committerMitchell Hashimoto <m@mitchellh.com>2025-09-29 06:40:01 -0700
commit3bc07c24aaac4cf58cbb845bc54c8c1cbf2ffa0c (patch)
tree00968d6f93be25036f5261e540cba0361b97bb08 /src/inspector
parentc5145d552e22afb3f657ddb13d7ec3b5e7ecea54 (diff)
lib-vt: OSC data extraction boilerplate
This also changes OSC strings to be null-terminated to ease lib-vt integration. This shouldn't have any practical effect on terminal performance, but it does lower the maximum length of OSC strings by 1 since we always reserve space for the null terminator.
Diffstat (limited to 'src/inspector')
-rw-r--r--src/inspector/termio.zig8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/inspector/termio.zig b/src/inspector/termio.zig
index 5ab9d3cd4..49ab00ecd 100644
--- a/src/inspector/termio.zig
+++ b/src/inspector/termio.zig
@@ -197,7 +197,9 @@ pub const VTEvent = struct {
) !void {
switch (@TypeOf(v)) {
void => {},
- []const u8 => try md.put("data", try alloc.dupeZ(u8, v)),
+ []const u8,
+ [:0]const u8,
+ => try md.put("data", try alloc.dupeZ(u8, v)),
else => |T| switch (@typeInfo(T)) {
.@"struct" => |info| inline for (info.fields) |field| {
try encodeMetadataSingle(
@@ -284,7 +286,9 @@ pub const VTEvent = struct {
try std.fmt.allocPrintZ(alloc, "{}", .{value}),
),
- []const u8 => try md.put(key, try alloc.dupeZ(u8, value)),
+ []const u8,
+ [:0]const u8,
+ => try md.put(key, try alloc.dupeZ(u8, value)),
else => |T| {
@compileLog(T);