From 8948c9ec1b8ade3d1e4ed7103fd4f6d17a8ea23e Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 28 Sep 2026 19:00:49 -0300 Subject: 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 --- src/fs.zig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/fs.zig') 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(); -- cgit v1.3