terminal: OSC color operations
parent
e13f9b9e8c
commit
1d03451d4f
|
|
@ -126,6 +126,7 @@ pub const Action = union(Key) {
|
|||
configure_charset: ConfigureCharset,
|
||||
set_attribute: sgr.Attribute,
|
||||
kitty_color_report: kitty.color.OSC,
|
||||
color_operation: ColorOperation,
|
||||
|
||||
pub const Key = lib.Enum(
|
||||
lib_target,
|
||||
|
|
@ -226,6 +227,7 @@ pub const Action = union(Key) {
|
|||
"configure_charset",
|
||||
"set_attribute",
|
||||
"kitty_color_report",
|
||||
"color_operation",
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -431,6 +433,18 @@ pub const Action = union(Key) {
|
|||
slot: charsets.Slots,
|
||||
charset: charsets.Charset,
|
||||
});
|
||||
|
||||
pub const ColorOperation = struct {
|
||||
op: osc.color.Operation,
|
||||
requests: osc.color.List,
|
||||
terminator: osc.Terminator,
|
||||
|
||||
pub const C = void;
|
||||
|
||||
pub fn cval(_: ColorOperation) ColorOperation.C {
|
||||
return {};
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/// Returns a type that can process a stream of tty control characters.
|
||||
|
|
@ -1904,14 +1918,11 @@ pub fn Stream(comptime Handler: type) type {
|
|||
},
|
||||
|
||||
.color_operation => |v| {
|
||||
if (@hasDecl(T, "handleColorOperation")) {
|
||||
try self.handler.handleColorOperation(
|
||||
v.op,
|
||||
&v.requests,
|
||||
v.terminator,
|
||||
);
|
||||
return;
|
||||
} else log.warn("unimplemented OSC callback: {}", .{cmd});
|
||||
try self.handler.vt(.color_operation, .{
|
||||
.op = v.op,
|
||||
.requests = v.requests,
|
||||
.terminator = v.terminator,
|
||||
});
|
||||
},
|
||||
|
||||
.kitty_color_protocol => |v| {
|
||||
|
|
|
|||
|
|
@ -302,6 +302,7 @@ pub const StreamHandler = struct {
|
|||
self.terminal.screen.kitty_keyboard.set(.not, value.flags);
|
||||
},
|
||||
.kitty_color_report => try self.kittyColorReport(value),
|
||||
.color_operation => try self.colorOperation(value.op, &value.requests, value.terminator),
|
||||
.prompt_end => try self.promptEnd(),
|
||||
.end_of_input => try self.endOfInput(),
|
||||
.end_hyperlink => try self.endHyperlink(),
|
||||
|
|
@ -1106,7 +1107,7 @@ pub const StreamHandler = struct {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn handleColorOperation(
|
||||
fn colorOperation(
|
||||
self: *StreamHandler,
|
||||
op: terminal.osc.color.Operation,
|
||||
requests: *const terminal.osc.color.List,
|
||||
|
|
|
|||
Loading…
Reference in New Issue