termio: hook up OSC8

This commit is contained in:
Mitchell Hashimoto
2024-07-04 10:49:53 -07:00
parent f920068ce6
commit 245314b14e
2 changed files with 16 additions and 3 deletions

View File

@ -1335,12 +1335,17 @@ pub fn Stream(comptime Handler: type) type {
}, },
.hyperlink_start => |v| { .hyperlink_start => |v| {
_ = v; if (@hasDecl(T, "startHyperlink")) {
@panic("TODO(osc8)"); try self.handler.startHyperlink(v.uri, v.id);
return;
} else log.warn("unimplemented OSC callback: {}", .{cmd});
}, },
.hyperlink_end => { .hyperlink_end => {
@panic("TODO(osc8)"); if (@hasDecl(T, "endHyperlink")) {
try self.handler.endHyperlink();
return;
} else log.warn("unimplemented OSC callback: {}", .{cmd});
}, },
} }

View File

@ -2358,6 +2358,14 @@ const StreamHandler = struct {
} }
} }
pub fn startHyperlink(self: *StreamHandler, uri: []const u8, id: ?[]const u8) !void {
try self.terminal.screen.startHyperlink(uri, id);
}
pub fn endHyperlink(self: *StreamHandler) !void {
self.terminal.screen.endHyperlink();
}
pub fn deviceAttributes( pub fn deviceAttributes(
self: *StreamHandler, self: *StreamHandler,
req: terminal.DeviceAttributeReq, req: terminal.DeviceAttributeReq,