summaryrefslogtreecommitdiff
path: root/src/Effect.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-06 12:15:23 -0300
committerGabriel Schneider <[email protected]>2026-11-06 14:56:36 -0300
commit9b60771ffcd254772b716fafe488b09d9c2d3e0c (patch)
tree917b658065d2aa1b5b59c797249d1fa5d32c0983 /src/Effect.zig
parent961bea06443e25a92e02be58136065c2a1ea84c1 (diff)
downloadpardes-9b60771ffcd254772b716fafe488b09d9c2d3e0c.tar.gz
pardes-9b60771ffcd254772b716fafe488b09d9c2d3e0c.zip
idioms #16, edits fail by name: the edit operations return edit.Error (memory, or a terminal's rows not read) and try where they caught and returned, so the key, chord or paste that ran one says the failure (`edit: out of memory`, reportError) where it did nothing; look, Core, File and terminal say theirs the same way, and the prints whose buffer provably fits catch unreachable with why
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/Effect.zig')
-rw-r--r--src/Effect.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Effect.zig b/src/Effect.zig
index 2bcf82f5..487fda82 100644
--- a/src/Effect.zig
+++ b/src/Effect.zig
@@ -347,7 +347,7 @@ test "Save on a scratch asks for a path in its inherited dir and makes it a file
try std.testing.expectEqualStrings(" Save /tmp/pardes-save-dir/", np.promptText().?);
// typing the filename and submitting converts it into an ordinary file
- edit.insertKey(p, &np.input, .{ .cp = 'n', .text = "note.txt" });
+ try edit.insertKey(p, &np.input, .{ .cp = 'n', .text = "note.txt" });
exec.submitSave(p, id);
// The write asked for, the pane is the file once it is done.
var saved = false;
@@ -372,7 +372,7 @@ test "Save on a terminal writes its plaintext scrollback and stays a terminal" {
try std.testing.expect(p.executeBuiltinLine(0, "Save"));
try std.testing.expect(pane.prompt == .save);
- edit.insertKey(p, &pane.input, .{ .cp = 'l', .text = "log.txt" });
+ try edit.insertKey(p, &pane.input, .{ .cp = 'l', .text = "log.txt" });
exec.submitSave(p, 0);
// the pane is untouched: still a terminal, no file behind it
@@ -421,7 +421,7 @@ test "Save on an output buffer writes its rows out and leaves the buffer alone"
try std.testing.expectEqualStrings(tagline.file_pane_tail, tagline.curTail(out));
try std.testing.expect(p.executeBuiltinLine(id, "Save"));
try std.testing.expect(out.prompt == .save);
- edit.insertKey(p, &out.input, .{ .cp = 'h', .text = "help.txt" });
+ try edit.insertKey(p, &out.input, .{ .cp = 'h', .text = "help.txt" });
exec.submitSave(p, id);
// the buffer itself is untouched: same origin, same name, still refillable