mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
parse ConEmu OSC9;5
This commit is contained in:
@ -178,6 +178,9 @@ pub const Command = union(enum) {
|
|||||||
progress: ?u8 = null,
|
progress: ?u8 = null,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/// Wait input (OSC 9;5)
|
||||||
|
wait_input: void,
|
||||||
|
|
||||||
pub const ColorKind = union(enum) {
|
pub const ColorKind = union(enum) {
|
||||||
palette: u8,
|
palette: u8,
|
||||||
foreground,
|
foreground,
|
||||||
@ -377,6 +380,7 @@ pub const Parser = struct {
|
|||||||
conemu_progress_state,
|
conemu_progress_state,
|
||||||
conemu_progress_prevalue,
|
conemu_progress_prevalue,
|
||||||
conemu_progress_value,
|
conemu_progress_value,
|
||||||
|
conemu_wait,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// This must be called to clean up any allocated memory.
|
/// This must be called to clean up any allocated memory.
|
||||||
@ -811,6 +815,11 @@ pub const Parser = struct {
|
|||||||
'4' => {
|
'4' => {
|
||||||
self.state = .conemu_progress_prestate;
|
self.state = .conemu_progress_prestate;
|
||||||
},
|
},
|
||||||
|
'5' => {
|
||||||
|
self.state = .conemu_wait;
|
||||||
|
self.command = .{ .wait_input = {} };
|
||||||
|
self.complete = true;
|
||||||
|
},
|
||||||
|
|
||||||
// Todo: parse out other ConEmu operating system commands.
|
// Todo: parse out other ConEmu operating system commands.
|
||||||
// Even if we don't support them we probably don't want
|
// Even if we don't support them we probably don't want
|
||||||
@ -943,6 +952,11 @@ pub const Parser = struct {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
.conemu_wait => {
|
||||||
|
self.state = .invalid;
|
||||||
|
self.complete = false;
|
||||||
|
},
|
||||||
|
|
||||||
.query_fg_color => switch (c) {
|
.query_fg_color => switch (c) {
|
||||||
'?' => {
|
'?' => {
|
||||||
self.command = .{ .report_color = .{ .kind = .foreground } };
|
self.command = .{ .report_color = .{ .kind = .foreground } };
|
||||||
@ -2096,6 +2110,30 @@ test "OSC: OSC9 progress pause with progress" {
|
|||||||
try testing.expect(cmd.progress.progress == 100);
|
try testing.expect(cmd.progress.progress == 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test "OSC: OSC9 conemu wait input" {
|
||||||
|
const testing = std.testing;
|
||||||
|
|
||||||
|
var p: Parser = .{};
|
||||||
|
|
||||||
|
const input = "9;5";
|
||||||
|
for (input) |ch| p.next(ch);
|
||||||
|
|
||||||
|
const cmd = p.end('\x1b').?;
|
||||||
|
try testing.expect(cmd == .wait_input);
|
||||||
|
}
|
||||||
|
|
||||||
|
test "OSC: OSC9 conemu wait invalid input" {
|
||||||
|
const testing = std.testing;
|
||||||
|
|
||||||
|
var p: Parser = .{};
|
||||||
|
|
||||||
|
const input = "9;5;";
|
||||||
|
for (input) |ch| p.next(ch);
|
||||||
|
|
||||||
|
const cmd = p.end('\x1b');
|
||||||
|
try testing.expect(cmd == null);
|
||||||
|
}
|
||||||
|
|
||||||
test "OSC: empty param" {
|
test "OSC: empty param" {
|
||||||
const testing = std.testing;
|
const testing = std.testing;
|
||||||
|
|
||||||
|
@ -1605,7 +1605,7 @@ pub fn Stream(comptime Handler: type) type {
|
|||||||
} else log.warn("unimplemented OSC callback: {}", .{cmd});
|
} else log.warn("unimplemented OSC callback: {}", .{cmd});
|
||||||
},
|
},
|
||||||
|
|
||||||
.progress, .sleep, .show_message_box, .change_conemu_tab_title => {
|
.progress, .sleep, .show_message_box, .change_conemu_tab_title, .wait_input => {
|
||||||
log.warn("unimplemented OSC callback: {}", .{cmd});
|
log.warn("unimplemented OSC callback: {}", .{cmd});
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user