termio/exec: handle semantic prompt events

This commit is contained in:
Mitchell Hashimoto
2023-05-27 15:48:31 -07:00
parent 4047a90555
commit de00892f8e
2 changed files with 18 additions and 0 deletions

View File

@ -483,6 +483,12 @@ pub fn Stream(comptime Handler: type) type {
} else log.warn("unimplemented OSC callback: {}", .{cmd});
},
.end_of_input => {
if (@hasDecl(T, "endOfInput")) {
try self.handler.endOfInput();
} else log.warn("unimplemented OSC callback: {}", .{cmd});
},
.end_of_command => |end| {
if (@hasDecl(T, "endOfCommand")) {
try self.handler.endOfCommand(end.exit_code);

View File

@ -1235,4 +1235,16 @@ const StreamHandler = struct {
),
}, .{ .forever = {} });
}
pub fn promptStart(self: *StreamHandler) !void {
self.terminal.markSemanticPrompt(.prompt);
}
pub fn promptEnd(self: *StreamHandler) !void {
self.terminal.markSemanticPrompt(.input);
}
pub fn endOfInput(self: *StreamHandler) !void {
self.terminal.markSemanticPrompt(.command);
}
};