mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 00:36:07 +03:00
add a formatter for CSI logs so that they're more easy to read
This commit is contained in:
@ -78,6 +78,22 @@ pub const Action = union(enum) {
|
||||
intermediates: []u8,
|
||||
params: []u16,
|
||||
final: u8,
|
||||
|
||||
// Implement formatter for logging
|
||||
pub fn format(
|
||||
self: CSI,
|
||||
comptime layout: []const u8,
|
||||
opts: std.fmt.FormatOptions,
|
||||
writer: anytype,
|
||||
) !void {
|
||||
_ = layout;
|
||||
_ = opts;
|
||||
try std.fmt.format(writer, "ESC [ {s} {any} {c}", .{
|
||||
self.intermediates,
|
||||
self.params,
|
||||
self.final,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
pub const ESC = struct {
|
||||
|
@ -49,8 +49,9 @@ pub fn Stream(comptime Handler: type) type {
|
||||
const actions = self.parser.next(c);
|
||||
for (actions) |action_opt| {
|
||||
// if (action_opt) |action| {
|
||||
// if (action != .print) {
|
||||
// log.info("action: {}", .{action});
|
||||
// switch (action) {
|
||||
// .print => |p| log.info("action: print '{u}'", .{p}),
|
||||
// else => log.info("action: {}", .{action}),
|
||||
// }
|
||||
// }
|
||||
switch (action_opt orelse continue) {
|
||||
|
Reference in New Issue
Block a user