From f3b5bd10ceb4c4db7263739770d5e4bdb879ba75 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Sat, 24 Oct 2026 14:16:32 -0300 Subject: Search converge 7/6: a script's Grep or Find that misses opens nothing, a dumped query pane restores as plain text; fs.py's Recent and canary to the query pane --- src/Query.zig | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/Query.zig') 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(); -- cgit v1.3