diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-01 18:01:07 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 18:08:12 -0300 |
| commit | 7f748c657121c801f219b28680373729fefce82a (patch) | |
| tree | 36ab19fece32e4b0b76778119045e3a21d32fbc6 /src/ninep/ctl.zig | |
| parent | 9dba9742f4f2071fd85c67c3a7fe311b7f37617c (diff) | |
| download | pardes-7f748c657121c801f219b28680373729fefce82a.tar.gz pardes-7f748c657121c801f219b28680373729fefce82a.zip | |
Putall saves every pane holding unsaved edits to a file, each as its own Save, a refused one said and the rest saved all the same
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/ctl.zig')
| -rw-r--r-- | src/ninep/ctl.zig | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index 269e9346..028ddf55 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -1809,6 +1809,25 @@ test "Get reads the pane's file again, refusing unsaved edits once, and Get file try testing.expect(!pane_files.dirtyOf(pane)); } +test "Putall saves every pane with unsaved edits to a file, one each, and leaves the rest" { + const p = try withFile(testing.allocator, "x\n"); + defer p.deinit(); + const first = serialOf(p); + _ = wr(p, Node.of(first, .name), "/tmp/pardes-putall-a.txt\n"); + _ = wr(p, Node.of(first, .body), "edited\n"); + const second = p.freeSlot().?; + _ = try p.newDocPane(second); + p.panes[second].?.file = .{ .path = try p.gpa.dupe(u8, "/tmp/pardes-putall-b.txt"), .content = try p.gpa.dupe(u8, "clean\n"), .history = try panes.File.History.create(p.gpa) }; + while (p.nextEffect()) |_| {} + try testing.expect(p.executeBuiltinLine(0, "Putall")); + var saves: usize = 0; + while (p.nextEffect()) |e| if (e == .save_file) { + saves += 1; + try testing.expectEqual(@as(u16, 0), e.save_file.pane); + }; + try testing.expectEqual(@as(usize, 1), saves); +} + test "a body write to a terminal is typed input, not a paste, even to a program that asked for bracketed paste" { const p = try Pardes.init(testing.allocator, .{ .cols = 90, .rows = 30 }); defer p.deinit(); @@ -3191,7 +3210,7 @@ test "acme's words run as pardes's (Put is Save, Delete a Del that does not ask) const p = try withFile(testing.allocator, "x\n"); defer p.deinit(); const serial = serialOf(p); - for ([_][]const u8{ "Snarf\n", "Putall\n", "Zerox\n", "Tab\n", "Indent\n", "Local\n", "Incl\n", "Abort\n" }) |line| { + for ([_][]const u8{ "Snarf\n", "Zerox\n", "Tab\n", "Indent\n", "Local\n", "Incl\n", "Abort\n" }) |line| { for ([_]u64{ Node.of(serial, .ctl), Node.of(serial, .exec) }) |node| { const r = wr(p, node, line); try testing.expectEqual(E.INVAL, r.errno()); |
