Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 38 additions & 1 deletion src/terminal/osc.zig
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ pub const Command = union(Key) {

kitty_clipboard_protocol: KittyClipboardProtocol,

/// OSC 3008. Hierarchical context signalling (UAPI spec).
/// https://uapi-group.org/specifications/specs/osc_context/
context_signal: parsers.context_signal.Command,

pub const SemanticPrompt = parsers.semantic_prompt.Command;

pub const KittyClipboardProtocol = parsers.kitty_clipboard_protocol.OSC;
Expand Down Expand Up @@ -187,6 +191,7 @@ pub const Command = union(Key) {
"conemu_comment",
"kitty_text_sizing",
"kitty_clipboard_protocol",
"context_signal",
},
);

Expand Down Expand Up @@ -226,7 +231,6 @@ pub const Command = union(Key) {
8 => 64,
else => unreachable,
});
// @compileLog(@sizeOf(Command));
}
};

Expand Down Expand Up @@ -311,12 +315,16 @@ pub const Parser = struct {
@"0",
@"1",
@"2",
@"3",
@"4",
@"5",
@"6",
@"7",
@"8",
@"9",
@"30",
@"300",
@"3008",
@"10",
@"11",
@"12",
Expand Down Expand Up @@ -411,6 +419,7 @@ pub const Parser = struct {
.show_desktop_notification,
.kitty_text_sizing,
.kitty_clipboard_protocol,
.context_signal,
=> {},
}

Expand Down Expand Up @@ -488,6 +497,7 @@ pub const Parser = struct {
'0' => self.state = .@"0",
'1' => self.state = .@"1",
'2' => self.state = .@"2",
'3' => self.state = .@"3",
'4' => self.state = .@"4",
'5' => self.state = .@"5",
'6' => self.state = .@"6",
Expand All @@ -497,6 +507,26 @@ pub const Parser = struct {
else => self.state = .invalid,
},

.@"3" => switch (c) {
'0' => self.state = .@"30",
else => self.state = .invalid,
},

.@"30" => switch (c) {
'0' => self.state = .@"300",
else => self.state = .invalid,
},

.@"300" => switch (c) {
'8' => self.state = .@"3008",
else => self.state = .invalid,
},

.@"3008" => switch (c) {
';' => self.writeToFixed(),
else => self.state = .invalid,
},

.@"1" => switch (c) {
';' => self.writeToFixed(),
'0' => self.state = .@"10",
Expand Down Expand Up @@ -704,6 +734,13 @@ pub const Parser = struct {

.@"55" => null,

.@"3",
.@"30",
.@"300",
=> null,

.@"3008" => parsers.context_signal.parse(self, terminator_ch),

.@"6" => null,

.@"66" => parsers.kitty_text_sizing.parse(self, terminator_ch),
Expand Down
1 change: 1 addition & 0 deletions src/terminal/osc/parsers.zig
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const std = @import("std");

pub const change_window_icon = @import("parsers/change_window_icon.zig");
pub const context_signal = @import("parsers/context_signal.zig");
pub const change_window_title = @import("parsers/change_window_title.zig");
pub const clipboard_operation = @import("parsers/clipboard_operation.zig");
pub const color = @import("parsers/color.zig");
Expand Down
Loading
Loading