some logging improvements

This commit is contained in:
Mitchell Hashimoto
2022-08-03 21:13:05 -07:00
parent b2a9f1f79e
commit 1680aee880
3 changed files with 5 additions and 3 deletions

View File

@ -16,7 +16,6 @@ const libuv = @import("libuv/main.zig");
const Pty = @import("Pty.zig"); const Pty = @import("Pty.zig");
const Command = @import("Command.zig"); const Command = @import("Command.zig");
const SegmentedPool = @import("segmented_pool.zig").SegmentedPool; const SegmentedPool = @import("segmented_pool.zig").SegmentedPool;
const frame = @import("tracy/tracy.zig").frame;
const trace = @import("tracy/tracy.zig").trace; const trace = @import("tracy/tracy.zig").trace;
const max_timer = @import("max_timer.zig"); const max_timer = @import("max_timer.zig");
const terminal = @import("terminal/main.zig"); const terminal = @import("terminal/main.zig");

View File

@ -77,7 +77,7 @@ pub fn init(alloc: Allocator, cols: usize, rows: usize) !Terminal {
.rows = rows, .rows = rows,
.active_screen = .primary, .active_screen = .primary,
// TODO: configurable scrollback // TODO: configurable scrollback
.screen = try Screen.init(alloc, rows, cols, 1000), .screen = try Screen.init(alloc, rows, cols, 10000),
// No scrollback for the alternate screen // No scrollback for the alternate screen
.secondary_screen = try Screen.init(alloc, rows, cols, 0), .secondary_screen = try Screen.init(alloc, rows, cols, 0),
.tabstops = try Tabstops.init(alloc, cols, TABSTOP_INTERVAL), .tabstops = try Tabstops.init(alloc, cols, TABSTOP_INTERVAL),

View File

@ -43,13 +43,16 @@ pub fn Stream(comptime Handler: type) type {
/// Process the next character and call any callbacks if necessary. /// Process the next character and call any callbacks if necessary.
pub fn next(self: *Self, c: u8) !void { pub fn next(self: *Self, c: u8) !void {
const tracy = trace(@src()); const tracy = trace(@src());
tracy.value(@intCast(u64, c));
defer tracy.end(); defer tracy.end();
//log.debug("char: {x}", .{c}); //log.debug("char: {x}", .{c});
const actions = self.parser.next(c); const actions = self.parser.next(c);
for (actions) |action_opt| { for (actions) |action_opt| {
if (action_opt) |action| { if (action_opt) |action| {
log.info("action: {}", .{action}); if (action != .print) {
log.info("action: {}", .{action});
}
} }
switch (action_opt orelse continue) { switch (action_opt orelse continue) {
.print => |p| if (@hasDecl(T, "print")) try self.handler.print(p), .print => |p| if (@hasDecl(T, "print")) try self.handler.print(p),