diff options
Diffstat (limited to 'src/tty/tty.zig')
| -rw-r--r-- | src/tty/tty.zig | 26 |
1 files changed, 3 insertions, 23 deletions
diff --git a/src/tty/tty.zig b/src/tty/tty.zig index 3441bc29..ef7f2761 100644 --- a/src/tty/tty.zig +++ b/src/tty/tty.zig @@ -1791,24 +1791,11 @@ const Shell = struct { fn writeFile(ctx: ?*anyopaque, pane: u8, path: []const u8, bytes: []const u8) void { const s = of(ctx); - filesystem.write(s.core, path, bytes) catch |err| - return s.core.saveFailed(pane, path, err); - if (s.core.panes[pane]) |pn| if (pn.file) |f| if (std.mem.eql(u8, f.path, path)) { - if (s.watches[pane]) |*w| if (w.serial == pn.serial) switch (w.generation) { - .text => w.generation = .{ .text = std.hash.Wyhash.hash(0, bytes) }, - .pdf => {}, - }; - }; - var mbuf: [256]u8 = undefined; - s.core.setMessage(pane, message.stamp(&mbuf, "saved", path)); + host_io.writeFile(s.core, &s.watches, pane, path, bytes); } fn writeDump(ctx: ?*anyopaque, bytes: []const u8) void { - const s = of(ctx); - var pbuf: [1024:0]u8 = undefined; - const path = pardes.dump.outPath(&pbuf, s.core.settings.dump_dir.get()) orelse return s.core.dumpFailed(s.core.settings.dump_dir.get(), error.NoDumpDirectory); - filesystem.write(s.core, path, bytes) catch |err| return s.core.dumpFailed(path, err); - s.core.setLastDump(path); + host_io.writeDump(of(ctx).core, bytes); } fn watchFile(ctx: ?*anyopaque, pane: u8, _: []const u8, on: bool, mode: pardes.WatchMode) void { @@ -1825,14 +1812,7 @@ const Shell = struct { fn dumpThemes(ctx: ?*anyopaque, pane: u8) void { const s = of(ctx); - const config_dir = s.core.opts.config_dir orelse return; - const out_dir = pardes.config.User.dumpThemes(s.io, s.gpa, config_dir, pardes.themes) catch |err| { - s.core.reportError(pane, "dump themes", err); - return; - }; - defer s.gpa.free(out_dir); - var mbuf: [256]u8 = undefined; - s.core.setMessage(pane, message.stamp(&mbuf, "dumped themes", out_dir)); + host_io.dumpThemes(s.core, s.io, s.gpa, pane); } fn setClipboard(ctx: ?*anyopaque, text: []const u8) void { |
