summaryrefslogtreecommitdiff
path: root/src/ninep/ctl.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/ninep/ctl.zig')
-rw-r--r--src/ninep/ctl.zig15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index 96c44d14..8a84e37f 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -431,8 +431,8 @@ pub fn paneText(p: *Pardes, pane: *Pane, buf: []u8) []const u8 {
// While a column's or the workspace's tag has the keyboard, no pane does.
const current = p.panes[p.active] == pane and !p.header_focus;
const f = pane_files.fileOf(pane);
- const undo = if (f) |file| file.history.undo_len > 0 else false;
- const redo = if (f) |file| file.history.redo_len > 0 else false;
+ const undo = if (f) |file| file.history.journal.done > 0 else false;
+ const redo = if (f) |file| file.history.journal.done < file.history.journal.steps.items.len else false;
w.print(" {d:>11} {d:>11} {d:>11} {s} ", .{ config.tab_now, @intFromBool(undo), @intFromBool(redo), if (current) "current" else "notcurrent" }) catch {};
// A terminal bound as a REPL ends with its id, `python-a`.
var idbuf: [48]u8 = undefined;
@@ -2695,8 +2695,15 @@ test "what a /pager open writes after its directory is the text: plain in the bo
try testing.expectEqual(pardes.Color{ .index = 1 }, f.pager_spans[0].style.fg);
try testing.expect(f.pager_spans[1].style.bold);
// One undo step back to the empty pane.
- try testing.expect(f.history.undo_len > 0);
- try testing.expectEqualStrings("", f.history.undo[f.history.undo_len - 1].content);
+ const j = &f.history.journal;
+ try testing.expect(j.done > 0);
+ const top = j.steps.items[j.done - 1];
+ try testing.expectEqual(@as(usize, 1), top.n);
+ // Its one entry took out the nothing the pane held and put the page in.
+ const e = j.entries.items[top.first];
+ try testing.expectEqual(@as(usize, 0), e.off);
+ try testing.expectEqual(@as(usize, 0), e.removed.len);
+ try testing.expectEqual(f.content.len, e.ins);
// An edit drops the colours (pager.zig's ponytail).
try testing.expectEqual(Status.ok, call(p, .{ .tag = 6, .op = .write, .node = Node.of(pn.serial, .body), .data = "more\n" }).reply.status);
try testing.expectEqual(@as(usize, 0), f.pager_spans.len);