summaryrefslogtreecommitdiff
path: root/src/ninep
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-24 11:57:26 -0300
committerGabriel Schneider <[email protected]>2026-10-24 11:57:35 -0300
commit51903dd947f90381d1a908c488a019289a1c8413 (patch)
treeab5b2574642493c60476e6e9bcd7cc0e1c5e8d9e /src/ninep
parent18d89dcedaed1f8437799621675e88ca47d7cdc1 (diff)
downloadpardes-51903dd947f90381d1a908c488a019289a1c8413.tar.gz
pardes-51903dd947f90381d1a908c488a019289a1c8413.zip
Search converge 3/6: the query pane, line 1 the query and its first word the source, rows made live like Callstack's, the owner's places showing the set, a +Preview promoted in place, Enter freezes, Esc restores
Diffstat (limited to 'src/ninep')
-rw-r--r--src/ninep/ctl.zig16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index f9bec775..45336a1e 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -89,6 +89,8 @@ pub fn run(p: *Pardes, id: usize, exec: bool, text: []const u8, in_tag: bool) vo
const after = Serials.snapshot(p);
var created = false;
for (after.list[0..after.len]) |serial| if (std.mem.indexOfScalar(u32, before.list[0..before.len], serial) == null) {
+ // A query pane's +Preview is its query pane's: that answers.
+ if (p.paneBySerial(serial)) |made| if (p.panes[made].?.file) |f| if (f.output) |o| if (o.from == .preview) continue;
// A look that made a +Search pane (LookWord list, a terminal)
// answers it: that is where the places it found are.
noteResult(p, serial);
@@ -555,6 +557,7 @@ fn checkBuiltin(p: *Pardes, req: Req, line: []const u8, scope: builtins.Scope) ?
// Bare, it says the width, as from a pane's exec.
.tab => arg.len == 0 or (std.fmt.parseInt(u16, arg, 10) catch 0) -% 1 < 16,
.callstack_depth => arg.len == 0 or (std.fmt.parseInt(u8, arg, 10) catch 0) -% 1 < pardes.lsp.callstack_max_depth,
+ .search_rows => arg.len == 0 or (std.fmt.parseInt(u16, arg, 10) catch 0) -% 1 < 100,
else => probe: {
var probe = p.settings;
break :probe probe.apply(setting, if (arg.len > 0) arg else null);
@@ -664,6 +667,7 @@ pub fn writeSettingsOf(p: *Pardes, s: *const config.Runtime, w: *std.Io.Writer)
.inactive_dim => try w.print("{s} {d}\n", .{ word, s.inactive_dim }),
.grip_width => try w.print("{s} {d}\n", .{ word, s.grip_width }),
.callstack_depth => try w.print("{s} {d}\n", .{ word, s.callstack_depth }),
+ .search_rows => try w.print("{s} {d}\n", .{ word, s.search_rows }),
.tab => try w.print("{s} {d}\n", .{ word, s.tab }),
}
}
@@ -3890,8 +3894,10 @@ test "Recent's row for a file still open is where its dot is now, not where it l
pane.body.cur_col = 2;
try testing.expectEqual(Status.ok, wr(p, root_exec, "Recent\n").reply.status);
const rows = p.panes[p.paneBySerial(try std.fmt.parseInt(u32, std.mem.trimEnd(u8, rd(p, root_exec, 0, 64).bytes, "\n"), 10)).?].?;
- var want: [4300]u8 = undefined;
- try testing.expect(std.mem.indexOf(u8, rows.file.?.content, try std.fmt.bufPrint(&want, "{s}/a.txt:2:3 open\n", .{dir})) != null);
+ // A query pane under the file (line 1 `Recent `), its rows said from
+ // its directory.
+ try testing.expect(std.mem.startsWith(u8, rows.file.?.content, "Recent \n"));
+ try testing.expect(std.mem.indexOf(u8, rows.file.?.content, "\na.txt:2:3 open\n") != null);
}
test "a closed file is found again: Recent and /recent list it closed, a look at its row reopens it at its dot, and a jump back does too" {
@@ -3924,7 +3930,8 @@ test "a closed file is found again: Recent and /recent list it closed, a look at
// Recent lists it, closed, at its dot; a look at the row opens it there.
try testing.expectEqual(Status.ok, wr(p, root_exec, "Recent\n").reply.status);
const rows = p.panes[p.paneBySerial(try std.fmt.parseInt(u32, std.mem.trimEnd(u8, rd(p, root_exec, 0, 64).bytes, "\n"), 10)).?].?;
- const at = std.mem.indexOf(u8, rows.file.?.content, try std.fmt.bufPrint(&want, "{s}:3:", .{a})).?;
+ // Its query pane's rows are said from its directory, a.txt's.
+ const at = std.mem.indexOf(u8, rows.file.?.content, "\na.txt:3:").? + 1;
const row = rows.file.?.content[at..std.mem.indexOfScalarPos(u8, rows.file.?.content, at, '\n').?];
try testing.expect(std.mem.endsWith(u8, row, " (closed)"));
try testing.expectEqual(Status.ok, wr(p, Node.of(rows.serial, .look), try std.fmt.bufPrint(&line, "{s}\n", .{row[0 .. row.len - " (closed)".len]})).reply.status);
@@ -3939,6 +3946,9 @@ test "a closed file is found again: Recent and /recent list it closed, a look at
var closed_entry = false;
for (p.jumps[0..p.njumps]) |j| closed_entry = closed_entry or j.serial == 0;
try testing.expect(closed_entry);
+ // Every entry in order (JumpScope all): which file has the focus after
+ // a Del is the layout's to choose, and Back keeps to it first.
+ p.settings.jump_scope = .all;
var tries: usize = 0;
while (tries < p.njumps) : (tries += 1) {
p.jumpBy(-1);