diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-01 11:18:32 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 11:23:34 -0300 |
| commit | 06d879ca1a896db73af89037ddcf5c317e1389a7 (patch) | |
| tree | 2398a381a862ce3d29f3e5f8c3889204f03c53bc | |
| parent | fe4115abf7b39ff3fad4e6d0669f61a53494c753 (diff) | |
| download | pardes-06d879ca1a896db73af89037ddcf5c317e1389a7.tar.gz pardes-06d879ca1a896db73af89037ddcf5c317e1389a7.zip | |
A bare Save on a +-named pane that is no output (+Tutor) asks for a path, as +New's does, never writing a file named +Tutor
Co-Authored-By: Claude Opus 5.5 <[email protected]>
| -rw-r--r-- | src/builtins.zig | 4 | ||||
| -rw-r--r-- | src/pardes.zig | 5 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/builtins.zig b/src/builtins.zig index b9cf4840..cca7bfb5 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -1124,7 +1124,9 @@ pub const Save = struct { return c.p.reportFailure(c.id, if (c.pane.hasPdf()) "Save: a PDF pane has no text to save" else "Save: an image pane has no text to save"); const path = std.mem.trim(u8, c.arg orelse "", " \t\r\n"); if (path.len > 0) return exec.saveTo(c.p, c.id, path); - if (c.pane.file) |file| if (file.output == null) return exec.saveFile(c.p, c.id); + // A `+` name is a generated pane's (+Tutor), no file of its own: + // a bare Save asks for a path, as a +New scratch's does. + if (c.pane.file) |file| if (file.output == null and !std.mem.startsWith(u8, std.fs.path.basename(file.path), "+")) return exec.saveFile(c.p, c.id); if (c.pane.file != null or c.pane.isTerminal()) c.p.startPrompt(c.pane, &c.pane.body, .save); } }; diff --git a/src/pardes.zig b/src/pardes.zig index 612a09aa..41ed0e5a 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -1197,6 +1197,11 @@ test "the Tutor pane is named +Tutor in the session's directory, never a bare pa p.session_dir_len = session.len; const tutor = try p.openTutorView(1); try std.testing.expectEqualStrings("/project/src/+Tutor", tutor.file.?.path); + // Its bare Save writes no file named +Tutor: it asks for a path. + while (p.nextEffect()) |_| {} + try std.testing.expect(p.executeBuiltinLine(1, "Save")); + try std.testing.expect(tutor.prompt == .save); + while (p.nextEffect()) |e| try std.testing.expect(e != .save_file); } test "first document keeps its originating shell and only opens a column when it fits" { |
