summaryrefslogtreecommitdiff
path: root/src/builtins.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/builtins.zig')
-rw-r--r--src/builtins.zig24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/builtins.zig b/src/builtins.zig
index f747765d..f207ed9f 100644
--- a/src/builtins.zig
+++ b/src/builtins.zig
@@ -460,7 +460,13 @@ pub const Ascii = struct {
pub const Save = struct {
pub fn run(c: Ctx) void {
// an output buffer has no file behind it — nothing to write
- if (c.pane.file) |f| if (output_pane.fileTraits(f.output).saves) c.p.emit(.{ .save_file = .{ .pane = @intCast(c.id) } });
+ if (c.pane.file) |*f| {
+ if (!output_pane.fileTraits(f.output).saves) return;
+ c.p.emit(.{ .save_file = .{ .pane = @intCast(c.id) } });
+ // ...and this edit is now the one on disk. See File.saved_revision
+ // for why the mark goes here rather than after the write.
+ f.saved_revision = f.revision;
+ }
}
};
@@ -536,6 +542,22 @@ pub const Help = struct {
}
};
+/// Where pardes read its startup commands from — the path, printed into an
+/// output buffer, `SPC f c` or the word executed anywhere.
+///
+/// The one question docs/config.md cannot answer, because the answer depends
+/// on the machine: XDG_CONFIG_HOME if it is set and absolute, else
+/// ~/Library/Application Support/pardes on macOS and ~/.config/pardes
+/// everywhere else. Printing it beats documenting it — the row is ordinary
+/// text, so a right click on it opens the file, and when there is no file
+/// there yet the path is still exactly what you needed to know.
+pub const Config = struct {
+ pub const output: OutputTraits = .{ .name = config.config_buffer };
+ pub fn run(c: Ctx) void {
+ output_pane.openConfig(c.p, c.id) catch |err| c.p.reportError(c.id, "config", err);
+ }
+};
+
// ---- search ----
// The two builtins that ASK for something — Find walks file NAMES under this