summaryrefslogtreecommitdiff
path: root/src/tty/tty.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/tty/tty.zig')
-rw-r--r--src/tty/tty.zig11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/tty/tty.zig b/src/tty/tty.zig
index ca263f90..de24f289 100644
--- a/src/tty/tty.zig
+++ b/src/tty/tty.zig
@@ -1352,7 +1352,7 @@ const Shell = struct {
fn ptyWrite(ctx: ?*anyopaque, pane: u8, bytes: []const u8) void {
const s = of(ctx);
- if (s.ptys[pane]) |pt| host_io.writeFd(pt.file.handle, bytes);
+ if (s.ptys[pane]) |pt| _ = host_io.writeFd(pt.file.handle, bytes);
}
fn ptyResize(ctx: ?*anyopaque, pane: u8, cols: u16, rows: u16) void {
@@ -1385,7 +1385,12 @@ const Shell = struct {
fn writeFile(ctx: ?*anyopaque, pane: u8, path: []const u8, bytes: []const u8) void {
const s = of(ctx);
- if (!host_io.writeFileBytes(path, bytes)) return;
+ // SAY WHY, and tell the core it did not happen. A save that cannot be
+ // done is the one failure this program must never swallow: `saveFailed`
+ // puts the reason on the pane's message row and leaves the pane dirty,
+ // so the ` *` stays and `Del` cannot quietly take the edits.
+ host_io.writeFileBytes(path, bytes) catch |err|
+ return s.core.saveFailed(pane, "save", err);
// our own write is about to come back as a watch event: restamp from
// the bytes we just put there so it reads as "no change". Only when
// this IS the pane's watched file — a `Save <elsewhere>` must not
@@ -1407,7 +1412,7 @@ const Shell = struct {
const s = of(ctx);
var pbuf: [1024:0]u8 = undefined;
const path = pardes.dump.outPath(&pbuf) orelse return;
- if (!host_io.writeFileBytes(path, bytes)) return;
+ host_io.writeFileBytes(path, bytes) catch |err| return s.core.reportError(0, "dump", err);
s.core.setLastDump(path);
}