terminal: setAttribute

This commit is contained in:
Mitchell Hashimoto
2025-10-24 11:51:30 -07:00
parent 56376a8a38
commit e49694439c
2 changed files with 18 additions and 21 deletions

View File

@@ -317,6 +317,11 @@ pub const StreamHandler = struct {
.end_of_command => self.endOfCommand(value.exit_code),
.mouse_shape => try self.setMouseShape(value),
.configure_charset => self.configureCharset(value.slot, value.charset),
.set_attribute => switch (value) {
.unknown => |unk| log.warn("unimplemented or unknown SGR attribute: {any}", .{unk}),
else => self.terminal.setAttribute(value) catch |err|
log.warn("error setting attribute {}: {}", .{ value, err }),
},
.dcs_hook => try self.dcsHook(value),
.dcs_put => try self.dcsPut(value),
.dcs_unhook => try self.dcsUnhook(),
@@ -716,15 +721,6 @@ pub const StreamHandler = struct {
}
}
pub inline fn setAttribute(self: *StreamHandler, attr: terminal.Attribute) !void {
switch (attr) {
.unknown => |unk| log.warn("unimplemented or unknown SGR attribute: {any}", .{unk}),
else => self.terminal.setAttribute(attr) catch |err|
log.warn("error setting attribute {}: {}", .{ attr, err }),
}
}
inline fn startHyperlink(self: *StreamHandler, uri: []const u8, id: ?[]const u8) !void {
try self.terminal.screen.startHyperlink(uri, id);
}