mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
OSC 133;C
This commit is contained in:
@ -32,6 +32,7 @@
|
||||
# Testing
|
||||
gdb
|
||||
tracy
|
||||
vttest
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
|
@ -32,6 +32,17 @@ pub const Command = union(enum) {
|
||||
/// or another prompt (OSC "133;P").
|
||||
prompt_end: void,
|
||||
|
||||
/// The OSC "133;C" command can be used to explicitly end
|
||||
/// the input area and begin the output area. However, some applications
|
||||
/// don't provide a convenient way to emit that command.
|
||||
/// That is why we also specify an implicit way to end the input area
|
||||
/// at the end of the line. In the case of multiple input lines: If the
|
||||
/// cursor is on a fresh (empty) line and we see either OSC "133;P" or
|
||||
/// OSC "133;I" then this is the start of a continuation input line.
|
||||
/// If we see anything else, it is the start of the output area (or end
|
||||
/// of command).
|
||||
end_of_input: void,
|
||||
|
||||
/// End of current command.
|
||||
///
|
||||
/// The exit-code need not be specified if if there are no options,
|
||||
@ -203,6 +214,12 @@ pub const Parser = struct {
|
||||
self.complete = true;
|
||||
},
|
||||
|
||||
'C' => {
|
||||
self.state = .semantic_option_start;
|
||||
self.command = .{ .end_of_input = .{} };
|
||||
self.complete = true;
|
||||
},
|
||||
|
||||
'D' => {
|
||||
self.state = .semantic_exit_code_start;
|
||||
self.command = .{ .end_of_command = .{} };
|
||||
@ -399,6 +416,18 @@ test "OSC: prompt_end" {
|
||||
try testing.expect(cmd == .prompt_end);
|
||||
}
|
||||
|
||||
test "OSC: end_of_input" {
|
||||
const testing = std.testing;
|
||||
|
||||
var p: Parser = .{};
|
||||
|
||||
const input = "133;C";
|
||||
for (input) |ch| p.next(ch);
|
||||
|
||||
const cmd = p.end().?;
|
||||
try testing.expect(cmd == .end_of_input);
|
||||
}
|
||||
|
||||
test "OSC: reset_cursor_color" {
|
||||
const testing = std.testing;
|
||||
|
||||
|
Reference in New Issue
Block a user