summaryrefslogtreecommitdiff
path: root/src/builtins.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 02:17:14 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:15 -0300
commit964709e115126aafa6fd5d8c984d511cf68cecaf (patch)
treea4367627d3c912116bc59b2c0577cb116ebc2c9c /src/builtins.zig
parent9fa0969549108bcdf05201e846226470e278a798 (diff)
downloadpardes-964709e115126aafa6fd5d8c984d511cf68cecaf.tar.gz
pardes-964709e115126aafa6fd5d8c984d511cf68cecaf.zip
Undo and Redo with nothing left say so, and the write succeeds
A pane's Undo or Redo with no step left did nothing and said nothing. It now says "Undo: nothing to undo" (or Redo's) as a message, not a failure, so a ctl write of it still succeeds as acme's silent Undo does. The docs give the 256-step history. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/builtins.zig')
-rw-r--r--src/builtins.zig5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/builtins.zig b/src/builtins.zig
index 51771c8f..8c6228c0 100644
--- a/src/builtins.zig
+++ b/src/builtins.zig
@@ -959,14 +959,19 @@ pub const Edit = struct {
/// acme's Undo and Redo (exec.c `undo`): step the pane's body back or
/// forward through its edits, from a tag, a pane ctl or exec.
+/// With no step left, Undo and Redo say so and change nothing; a ctl write
+/// of them still succeeds, as acme's Undo is silent there. A file keeps
+/// limits.undo_max steps (256).
pub const Undo = struct {
pub fn run(c: Ctx) void {
+ if (c.pane.file) |f| if (f.history.undo_len == 0) return c.p.setMessage(c.id, "Undo: nothing to undo");
edit.doUndo(c.p, &c.pane.body);
}
};
pub const Redo = struct {
pub fn run(c: Ctx) void {
+ if (c.pane.file) |f| if (f.history.redo_len == 0) return c.p.setMessage(c.id, "Redo: nothing to redo");
edit.doRedo(c.p, &c.pane.body);
}
};