mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
osc: prompt_end
This commit is contained in:
@ -28,6 +28,10 @@ pub const Command = union(enum) {
|
||||
aid: ?[]const u8 = null,
|
||||
},
|
||||
|
||||
/// End of prompt and start of user input, terminated by a OSC "133;C"
|
||||
/// or another prompt (OSC "133;P").
|
||||
prompt_end: void,
|
||||
|
||||
/// End of current command.
|
||||
///
|
||||
/// The exit-code need not be specified if if there are no options,
|
||||
@ -162,6 +166,12 @@ pub const Parser = struct {
|
||||
self.complete = true;
|
||||
},
|
||||
|
||||
'B' => {
|
||||
self.state = .semantic_option_start;
|
||||
self.command = .{ .prompt_end = .{} };
|
||||
self.complete = true;
|
||||
},
|
||||
|
||||
'D' => {
|
||||
self.state = .semantic_exit_code_start;
|
||||
self.command = .{ .end_of_command = .{} };
|
||||
@ -331,3 +341,15 @@ test "OSC: end_of_command with exit code" {
|
||||
try testing.expect(cmd == .end_of_command);
|
||||
try testing.expectEqual(@as(u8, 25), cmd.end_of_command.exit_code.?);
|
||||
}
|
||||
|
||||
test "OSC: prompt_end" {
|
||||
const testing = std.testing;
|
||||
|
||||
var p: Parser = .{};
|
||||
|
||||
const input = "133;B";
|
||||
for (input) |ch| p.next(ch);
|
||||
|
||||
const cmd = p.end().?;
|
||||
try testing.expect(cmd == .prompt_end);
|
||||
}
|
||||
|
Reference in New Issue
Block a user