diff options
Diffstat (limited to 'src/Query.zig')
| -rw-r--r-- | src/Query.zig | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/Query.zig b/src/Query.zig index 6374ce42..a871b71e 100644 --- a/src/Query.zig +++ b/src/Query.zig @@ -1998,6 +1998,24 @@ test "a / query: keystroke by keystroke, the owner shows the set, rows from its try std.testing.expectEqual(@as(i32, 2), pane.body.cur_row); } +test "a dump holding a query pane, live or frozen, restores, the pane as plain text" { + const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 40 }); + defer p.deinit(); + _ = try p.setTestFile("alpha one\nbeta\nalphabet\n"); + typeKeys(p, "/alpha"); + for (0..2) |_| { + const qid = queryPane(p).?; + try pardes.dump.dumpState(p); + const restored = try pardes.dump.initFromDump(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 40 }, p.dump_out.?); + defer restored.deinit(); + const back = restored.panes[qid].?; + try std.testing.expect(back.query == null); + try std.testing.expectEqual(@as(usize, 0), back.file.?.location_rows.len); + try std.testing.expect(std.mem.startsWith(u8, back.file.?.content, "/alpha\n")); + p.update(.{ .key = .{ .cp = Key.enter } }); + } +} + test "a / query: Enter lands and freezes, the register filled, n and N step silently, a later / reuses the pane and Esc brings the frozen rows back" { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 40 }); defer p.deinit(); |
