地圖 (Jido) is a lightweight Unix TUI file explorer designed for speed and simplicity.

fix: Remove need to init notification handler. This fixes many issues with the places in the code notifications could be produced.

+4 -12
+1 -5
src/app.zig
··· 55 55 drawer: Drawer = Drawer{}, 56 56 57 57 directories: Directories, 58 - notification: Notification, 58 + notification: Notification = Notification{}, 59 59 // Assigned in main after config parsing. 60 60 file_logger: FileLogger = undefined, 61 61 ··· 76 76 }, 77 77 }); 78 78 79 - var notification = Notification{}; 80 - notification.init(); 81 - 82 79 return App{ 83 80 .alloc = alloc, 84 81 .should_quit = false, ··· 86 83 .tty = try vaxis.Tty.init(), 87 84 .directories = try Directories.init(alloc), 88 85 .text_input = vaxis.widgets.TextInput.init(alloc, &vx.unicode), 89 - .notification = notification, 90 86 .actions = CircStack(Action, actions_len).init(), 91 87 .last_known_height = vx.window().height, 92 88 };
+3 -7
src/notification.zig
··· 47 47 48 48 const Warn = enum { DeprecatedConfigPath, DuplicateFileOnUndo }; 49 49 50 - buf: [1024]u8 = undefined, 50 + var buf: [1024]u8 = undefined; 51 + 51 52 style: Style = Style.info, 52 - fbs: std.io.FixedBufferStream([]u8) = undefined, 53 + fbs: std.io.FixedBufferStream([]u8) = std.io.fixedBufferStream(&buf), 53 54 /// How long until the notification disappears in seconds. 54 55 timer: i64 = 0, 55 - 56 - pub fn init(self: *Self) void { 57 - self.fbs = std.io.fixedBufferStream(&self.buf); 58 - self.timer = std.time.timestamp(); 59 - } 60 56 61 57 pub fn write(self: *Self, text: []const u8, style: Style) !void { 62 58 self.fbs.reset();