summaryrefslogtreecommitdiff
path: root/src/fs.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-28 19:00:49 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:15 -0300
commit8948c9ec1b8ade3d1e4ed7103fd4f6d17a8ea23e (patch)
tree0e7ca727fd79fd0c1605a166203917db3d968566 /src/fs.zig
parent5a5c9c9698c2621d3509c687880d22e904f25139 (diff)
downloadpardes-8948c9ec1b8ade3d1e4ed7103fd4f6d17a8ea23e.tar.gz
pardes-8948c9ec1b8ade3d1e4ed7103fd4f6d17a8ea23e.zip
A replace through data or body, truncate then write, is one undo step
A shell's printf x > data truncates the addressed range and then writes, and each pushed its own undo point, so one replace took two Undos. A truncation of data, xdata or body now lets the write that follows it at once join its step, as acme's replace is one. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/fs.zig')
-rw-r--r--src/fs.zig3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/fs.zig b/src/fs.zig
index 42d761ca..0a4473d6 100644
--- a/src/fs.zig
+++ b/src/fs.zig
@@ -598,7 +598,8 @@ test "virtual body writes can read their input from the same pane" {
const path = try std.fmt.bufPrint(&path_buffer, "/virtual/pane/{d}/body", .{pane.serial});
try write(p, path, pane.file.?.content);
try std.testing.expectEqualStrings("same pane contents\n", pane.file.?.content);
- try std.testing.expectEqual(@as(usize, 2), pane.file.?.history.undo_len);
+ // The truncation and the write are one undo step.
+ try std.testing.expectEqual(@as(usize, 1), pane.file.?.history.undo_len);
const events = &p.panes[p.active].?.fs.events;
try std.testing.expect(std.mem.startsWith(u8, events.peek().?, "ED"));
events.pop();