summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/Pick.zig145
-rw-r--r--core/Trail.zig29
-rw-r--r--core/exec.zig2
-rw-r--r--core/layout.zig307
-rw-r--r--core/look.zig18
-rw-r--r--docs/typ/reference.typ11
-rw-r--r--test/snapshots/diffstack.golden62
-rw-r--r--test/snapshots/look-fd-deep.golden12
-rw-r--r--test/snapshots/nested.golden26
-rw-r--r--test/snapshots/pagercolor.golden28
-rw-r--r--test/snapshots/psearch.golden52
-rw-r--r--test/snapshots/ttyhelp.golden50
12 files changed, 572 insertions, 170 deletions
diff --git a/core/Pick.zig b/core/Pick.zig
index b76020ca..2bcaf76f 100644
--- a/core/Pick.zig
+++ b/core/Pick.zig
@@ -233,9 +233,11 @@ fn make(p: *Pardes, source: Source) !*Pick {
}
/// Picker `pk` asked from pane `from`: the pane it lands in is `from` when
-/// it reads; its reader when it is held and has one; else a pane made under
-/// it as its reader would be, empty until the preview fills it. The
-/// keyboard stays where it was: the landing pane is the tag's host.
+/// it reads; its reader when it is held and has one; else an untouched
+/// pane, `from` itself first (UX J1), which previews as a reading pane does
+/// and is given back as it was on Esc; else a pane made where its reader
+/// would go, empty until the preview fills it. The keyboard stays where it
+/// was: the landing pane is the tag's host.
fn hostIn(p: *Pardes, pk: *Pick, from: usize) !void {
const asker = p.panes[from].?;
pk.owner = asker.serial;
@@ -247,13 +249,17 @@ fn hostIn(p: *Pardes, pk: *Pick, from: usize) !void {
p.view().active = from;
return;
}
- const reader = if (Trail.reading(p, asker)) from else Trail.readerOf(p, asker);
+ var reader = if (Trail.reading(p, asker)) from else Trail.readerOf(p, asker);
+ if (reader == null) if (layout.freeSpace(p, from, .reader)) |free| if (free == .pane) {
+ reader = free.pane;
+ };
pk.landing = p.panes[reader orelse try landingFor(p, from)].?.serial;
pk.made = reader == null;
p.view().active = from;
}
-/// A pane made under pane `from` for a picker, where its reader goes.
+/// A pane made for a picker where pane `from`'s reader goes: under it, or
+/// an empty column (layout.freeSpace).
fn landingFor(p: *Pardes, from: usize) !usize {
const asker = p.panes[from].?;
const free = p.freeSlot() orelse return error.NoPaneSlots;
@@ -1340,8 +1346,10 @@ const How = enum { walk, below, column, queue };
/// Enter: the current row, or the marked ones, looked at from the asking
/// pane (look.open, the walk's way: a reading pane steps, a held one's
/// reader does), the first as `how` says, the others each in a pane below.
-/// The list rolls into the landing pane's trail as its word (item 4).
-fn land(p: *Pardes, how: How) void {
+/// The list rolls into the landing pane's trail as its word (item 4). From
+/// an untouched pane S-Enter and C-v are Enter: it is the free space a new
+/// pane would take (UX J1).
+fn land(p: *Pardes, wanted: How) void {
const pk = live(p) orelse return;
var arena = std.heap.ArenaAllocator.init(p.gpa);
defer arena.deinit();
@@ -1352,7 +1360,7 @@ fn land(p: *Pardes, how: How) void {
pk.queue.clearRetainingCapacity();
pk.queue_bytes.clearRetainingCapacity();
pk.queue_at = 0;
- if (how == .queue) for (picked[1..]) |t| switch (t) {
+ if (wanted == .queue) for (picked[1..]) |t| switch (t) {
.place => |at| {
const q: Queued = .{ .path = @intCast(pk.queue_bytes.items.len), .len = @intCast(@min(at.path.len, std.math.maxInt(u16))), .line = std.math.lossyCast(u32, at.at.line), .col = std.math.lossyCast(u32, at.at.col) };
pk.queue_bytes.appendSlice(p.gpa, at.path[0..q.len]) catch break;
@@ -1360,13 +1368,16 @@ fn land(p: *Pardes, how: How) void {
},
else => {},
};
- // A step from the pane it lands in when that reads (its owner's reader
- // or itself), else from its owner, whose reader the place opens as.
- const landing = if (pk.made) null else p.paneBySerial(pk.landing);
TagState.toRest(p);
const v = p.view();
const owner = p.paneBySerial(pk.owner) orelse v.active;
- const from = if (how == .walk or how == .queue) landing orelse owner else owner;
+ const how: How = if ((wanted == .below or wanted == .column) and Trail.untouched(p, p.panes[owner].?)) .walk else wanted;
+ // A step from the pane it lands in when that reads (its owner's reader
+ // or itself), else from its owner, whose reader the place opens as:
+ // where the pane made for the picker was, or in the untouched pane it
+ // previewed in (UX J1), given back now.
+ const landing = p.paneBySerial(pk.landing) orelse owner;
+ const from = if ((how == .walk or how == .queue) and Trail.reading(p, p.panes[landing].?)) landing else owner;
v.active = from;
v.jumps.force = true;
for (picked, 0..) |t, k| switch (t) {
@@ -1383,9 +1394,11 @@ fn land(p: *Pardes, how: How) void {
else => listed(p, pk),
}
} else if (k == 0 and how == .column) {
- layout.newColumn(p, from);
- const c = layout.activeColumn(p) orelse continue;
- p.exec_column = c;
+ // A column made only where there is no free space (UX J1).
+ if (layout.freeSpace(p, from, .doc) == null) {
+ layout.newColumn(p, from);
+ p.exec_column = layout.activeColumn(p) orelse continue;
+ }
defer p.exec_column = null;
pardes.tagline.exitHeader(p);
_ = look.open(p, from, at.path, at.at, .below);
@@ -1978,6 +1991,7 @@ test "Enter lands as a walk step in the reading pane; S-Enter opens below; from
const b_path = try testFile(p, &tmp, "beta.zig", "one\ntwo\nthree\n");
defer p.gpa.free(b_path);
look.lookAt(p, p.view().active, a_path);
+ p.sync();
const id = p.view().active;
const npanes = paneCount(p);
open(p, id, .list, "Refs", "", "beta.zig:3:1 three\n");
@@ -2193,6 +2207,7 @@ test "a picker from a reading pane unrolls in that pane, its own text set aside
const b_path = try testFile(p, &tmp, "beta.zig", "one\ntwo\nthree\n");
defer p.gpa.free(b_path);
look.lookAt(p, p.view().active, a_path);
+ p.sync();
const id = p.view().active;
try std.testing.expect(Trail.reading(p, p.panes[id].?));
const npanes = paneCount(p);
@@ -2620,3 +2635,103 @@ test "Backspace on a Messages picker's empty field goes back to the level it was
p.sync();
_ = try p.render(frame.allocator());
}
+
+test "a picker started in an untouched +New previews in it (UX J1): no pane made, Esc gives it back empty, Enter lands in it, the same pane by its number, reading, its trail starting at the list word; S-Enter there is Enter" {
+ const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 140, .rows = 50 });
+ defer p.deinit();
+ p.settings.jumps = .walk;
+ var tmp = std.testing.tmpDir(.{});
+ defer tmp.cleanup();
+ const b_path = try testFile(p, &tmp, "beta.zig", "one\ntwo\nthree\n");
+ defer p.gpa.free(b_path);
+ const rows = try std.fmt.allocPrint(p.gpa, "{s}:3:1 three\n", .{b_path});
+ defer p.gpa.free(rows);
+ _ = try p.setTestFile("first\n");
+ for ([_]bool{ false, true }) |shift| {
+ exec.runBuiltin(p, .New, 0, "New", null);
+ p.sync();
+ const scratch = p.view().active;
+ const serial = p.panes[scratch].?.serial;
+ const top = p.view().rects[scratch].y;
+ const npanes = paneCount(p);
+ try std.testing.expect(Trail.untouched(p, p.panes[scratch].?));
+ open(p, scratch, .list, "Refs", "", rows);
+ settle(p);
+ p.update(.tick);
+ try std.testing.expect(!live(p).?.made);
+ try std.testing.expectEqual(serial, live(p).?.landing);
+ try std.testing.expectEqual(npanes, paneCount(p));
+ try std.testing.expectEqualStrings(b_path, p.panes[scratch].?.file.?.path);
+ // Esc: the +New as it was, still free space.
+ p.update(.{ .key = .{ .cp = Key.escape } });
+ try std.testing.expectEqual(npanes, paneCount(p));
+ try std.testing.expect(Trail.untouched(p, p.panes[scratch].?));
+ try std.testing.expectEqual(serial, p.panes[scratch].?.serial);
+ // Enter (or S-Enter): the file in it.
+ open(p, scratch, .list, "Refs", "", rows);
+ settle(p);
+ p.update(.{ .key = .{ .cp = Key.enter, .shift = shift } });
+ p.sync();
+ try std.testing.expect(live(p) == null);
+ const here = p.panes[p.view().active].?;
+ try std.testing.expectEqual(serial, here.serial);
+ try std.testing.expectEqualStrings(b_path, here.file.?.path);
+ try std.testing.expectEqual(@as(i32, 2), here.body.cur_row);
+ try std.testing.expectEqual(npanes, paneCount(p));
+ try std.testing.expectEqual(top, p.view().rects[p.view().active].y);
+ try std.testing.expect(Trail.reading(p, here));
+ try std.testing.expectEqual(@as(u8, 2), here.trail.n);
+ try std.testing.expect(here.trail.steps[0] == .list and here.trail.steps[1] == .place);
+ }
+}
+
+test "a picker from a held pane previews in an untouched +New (UX J1): Esc gives it back empty, Enter makes it the held pane's reader by its number; C-v lands in an empty column rather than making one" {
+ const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 140, .rows = 50 });
+ defer p.deinit();
+ p.settings.jumps = .walk;
+ var tmp = std.testing.tmpDir(.{});
+ defer tmp.cleanup();
+ const b_path = try testFile(p, &tmp, "beta.zig", "one\ntwo\nthree\n");
+ defer p.gpa.free(b_path);
+ const rows = try std.fmt.allocPrint(p.gpa, "{s}:3:1 three\n", .{b_path});
+ defer p.gpa.free(rows);
+ _ = try p.setTestFile("held\n");
+ const held = p.view().active;
+ Trail.keep(p.panes[held].?);
+ exec.runBuiltin(p, .New, held, "New", null);
+ p.sync();
+ const scratch = p.view().active;
+ const serial = p.panes[scratch].?.serial;
+ p.view().active = held;
+ const npanes = paneCount(p);
+ open(p, held, .list, "Refs", "", rows);
+ settle(p);
+ p.update(.tick);
+ try std.testing.expect(!live(p).?.made);
+ try std.testing.expectEqual(serial, live(p).?.landing);
+ try std.testing.expectEqualStrings(b_path, p.panes[scratch].?.file.?.path);
+ p.update(.{ .key = .{ .cp = Key.escape } });
+ try std.testing.expectEqual(npanes, paneCount(p));
+ try std.testing.expect(Trail.untouched(p, p.panes[scratch].?));
+ open(p, held, .list, "Refs", "", rows);
+ settle(p);
+ p.update(.{ .key = .{ .cp = Key.enter } });
+ p.sync();
+ const reader = Trail.readerOf(p, p.panes[held].?).?;
+ try std.testing.expectEqual(serial, p.panes[reader].?.serial);
+ try std.testing.expectEqualStrings(b_path, p.panes[reader].?.file.?.path);
+ try std.testing.expectEqual(p.panes[held].?.serial, p.panes[reader].?.trail.steps[0].owner);
+ try std.testing.expectEqual(npanes, paneCount(p));
+ // C-v with an empty column there: the place goes in it.
+ Trail.keep(p.panes[reader].?);
+ const c = layout.insertColumn(p, layout.findPane(p, held).?.col, false).?;
+ p.sync();
+ const ncol = p.view().ncol;
+ open(p, held, .list, "Refs", "", rows);
+ settle(p);
+ p.update(.{ .key = .{ .cp = 'v', .ctrl = true } });
+ p.sync();
+ try std.testing.expectEqual(ncol, p.view().ncol);
+ try std.testing.expectEqual(c, layout.findPane(p, p.view().active).?.col);
+ try std.testing.expectEqualStrings(b_path, p.panes[p.view().active].?.file.?.path);
+}
diff --git a/core/Trail.zig b/core/Trail.zig
index 96d505ae..3003a7df 100644
--- a/core/Trail.zig
+++ b/core/Trail.zig
@@ -79,6 +79,25 @@ pub fn reading(p: *const Pardes, pane: *const Pane) bool {
return p.settings.jumps == .walk and isFile(pane) and !pane.trail.held;
}
+/// An untouched pane (UX J1): a `+New` never typed into (no undo
+/// history), its body empty, still so named, not kept, not folded, and no
+/// 9P open holding it: a look or exec open answered with it (exec.leased),
+/// or an open of one of its own files (a script's look or exec at it, an
+/// event helper's event), so that a script's pane/new stays its own. It is
+/// free space: the next pane made takes its place (layout.freeSpace), a
+/// jump from it among them.
+pub fn untouched(p: *const Pardes, pane: *const Pane) bool {
+ const f = pane.file orelse return false;
+ const o = f.output orelse return false;
+ if (o.from != .cmd or o.from.cmd != .New or f.pager) return false;
+ if (f.content.len != 0 or f.history.journal.steps.items.len != 0 or pane.trail.held or pane.collapsed) return false;
+ if (!std.mem.eql(u8, std.Io.Dir.path.basename(f.path), config.scratch_buffer) or @import("exec.zig").leased(p, pane.serial)) return false;
+ for (p.fs.opens[0..p.fs.opens_len]) |open| if (open.node != 0) if (pardes.ctlfs.Node.target(open.node)) |t| {
+ if (t == .pane and t.pane.serial == pane.serial) return false;
+ };
+ return true;
+}
+
/// The reading pane that is held pane `owner`'s reader, if it has one.
pub fn readerOf(p: *const Pardes, owner: *const Pane) ?usize {
for (p.panes, 0..) |slot, id| {
@@ -89,12 +108,14 @@ pub fn readerOf(p: *const Pardes, owner: *const Pane) ?usize {
return null;
}
-/// A new reader's trail: its owner, then where it opened.
-pub fn reader(owner: u32, path: []const u8, at: Spot) Trail {
+/// A new reader's trail: its owner, then where it opened. With no owner,
+/// a jump's from an untouched pane, whose place it takes (UX J1): its
+/// trail starts at the file.
+pub fn reader(owner: ?u32, path: []const u8, at: Spot) Trail {
var t: Trail = .{};
- push(&t, .{ .owner = owner });
+ if (owner) |o| push(&t, .{ .owner = o });
if (placeOf(path, at.line, at.col)) |s| push(&t, s);
- t.cur = t.n - 1;
+ t.cur = t.n -| 1;
return t;
}
diff --git a/core/exec.zig b/core/exec.zig
index 5a5ff725..a56c17f9 100644
--- a/core/exec.zig
+++ b/core/exec.zig
@@ -802,7 +802,7 @@ pub fn runCommand(p: *Pardes, from: usize, line: []const u8) ?usize {
/// Whether an open of a look or exec file holds `serial` from its own write
/// (tree.Open.results): its client is reading that pane.
-fn leased(p: *const Pardes, serial: u32) bool {
+pub fn leased(p: *const Pardes, serial: u32) bool {
for (p.fs.opens[0..p.fs.opens_len]) |o| if (o.node != 0 and o.results.wrote) {
if (std.mem.indexOfScalar(u32, o.results.list[0..o.results.len], serial) != null) return true;
};
diff --git a/core/layout.zig b/core/layout.zig
index 4b5b7d2c..89d206b9 100644
--- a/core/layout.zig
+++ b/core/layout.zig
@@ -11,6 +11,7 @@ const TOPBAR_H = pardes.TOPBAR_H;
const COLBAR_H = pardes.COLBAR_H;
const MAX_TAG_ROWS = pardes.MAX_TAG_ROWS;
const Pane = pardes.Pane;
+const Trail = @import("Trail.zig");
pub const Rect = struct { x: u16 = 0, y: u16 = 0, w: u16 = 0, h: u16 = 0 };
const MAX_COLS = pardes.MAX_COLS;
const MAX_PANES = pardes.MAX_PANES;
@@ -946,9 +947,9 @@ pub fn replacePane(p: *Pardes, old: usize, new: usize) void {
}
}
-/// Put new pane `id` in the layout: every new pane comes through here, as
-/// acme's makenewwindow places it, and every one but a command pane takes
-/// the keyboard. `from` is the pane that asked, `origin` the text it asked
+/// Put new pane `id` in the layout: every new pane comes through here,
+/// into free space first (freeSpace), else as acme's makenewwindow places
+/// it, and every one but a command pane takes the keyboard. `from` is the pane that asked, `origin` the text it asked
/// from: null when a column tag, the workspace tag or 9P asked (acme's
/// t->w == nil).
pub fn placeNew(p: *Pardes, from: usize, origin: ?usize, id: usize, kind: NewPane) void {
@@ -960,24 +961,32 @@ pub fn placeNew(p: *Pardes, from: usize, origin: ?usize, id: usize, kind: NewPan
compute(p);
const before = v.rects;
const before_min = minima(p);
- switch (kind) {
- // New: the bottom half of the last pane in its own column
- // (look.c:921-923, et->col).
- .scratch => acmePlace(p, p.exec_column orelse columnOf(p, from), null, id),
- // +Errors, a command's output: the last column (util.c:94-98); a
- // command run from a column's tag, that column.
- .command => acmePlace(p, p.exec_column orelse v.ncol - 1, null, id),
- .errors => acmePlace(p, v.ncol - 1, null, id),
- // makenewwindow(nil) for 9P's new (acme.c:877), else (t).
- .fs => acmePlace(p, acmeColumn(p, from), null, id),
- .shell, .doc => acmePlace(p, acmeColumn(p, from), asked, id),
+ // Free space first (UX J1): an untouched pane is taken, an empty
+ // column filled, before any pane is split; an untouched pane only where
+ // its rows hold the new one's tag at that width and two rows, as every
+ // placement leaves a pane.
+ const free = if (freeSpace(p, from, kind)) |space| switch (space) {
+ .pane => |k| holds: {
+ v.rects[id].w = v.rects[k].w;
+ break :holds if (v.rects[k].h >= minRows(p, id)) space else null;
+ },
+ .column => space,
+ } else null;
+ if (free) |space| switch (space) {
+ .pane => |k| takePane(p, k, id),
+ .column => |c| acmePlace(p, c, null, id),
+ } else switch (kind) {
.reader => readerPlace(p, from, id),
+ // makenewwindow(t) asked from a pane's text.
+ .shell, .doc => acmePlace(p, columnFor(p, from, kind), asked, id),
+ .scratch, .fs, .command, .errors => acmePlace(p, columnFor(p, from, kind), null, id),
}
// No pane is made shorter than its tag and two rows: where the place
// chosen has not the room, the column's tallest pane gives it, and
// where none can, the pane is refused, and closed at the step's end
- // (Pardes.unplaced) once whatever made it is done with it.
- if (!placedRoomy(p, id, &before)) if (findPane(p, id)) |f| {
+ // (Pardes.unplaced) once whatever made it is done with it. Free space
+ // splits no pane: a pane taken gives its rows whatever they are.
+ if (free == null and !placedRoomy(p, id, &before)) if (findPane(p, id)) |f| {
removePane(p, id);
for (v.cols[f.col].panes[0..p.view().cols[f.col].n]) |k| v.rects[k] = before[k];
snapColWeights(p, f.col);
@@ -1045,6 +1054,76 @@ pub fn placeNew(p: *Pardes, from: usize, origin: ?usize, id: usize, kind: NewPan
if (findPane(p, id)) |f| p.setActiveColumn(f.col);
}
+/// The column a new pane of `kind` asked from pane `from` goes in.
+fn columnFor(p: *Pardes, from: usize, kind: NewPane) usize {
+ return switch (kind) {
+ // New: the bottom half of the last pane in its own column
+ // (look.c:921-923, et->col).
+ .scratch => p.exec_column orelse columnOf(p, from),
+ // +Errors, a command's output: the last column (util.c:94-98); a
+ // command run from a column's tag, that column.
+ .command => p.exec_column orelse p.view().ncol - 1,
+ .errors => p.view().ncol - 1,
+ // makenewwindow(nil) for 9P's new (acme.c:877), else (t).
+ .fs, .shell, .doc => acmeColumn(p, from),
+ // Its held pane's (readerPlace).
+ .reader => columnOf(p, from),
+ };
+}
+
+/// Free space (UX J1): an untouched pane (Trail.untouched) or an empty
+/// column.
+pub const Free = union(enum) { pane: usize, column: usize };
+
+/// The free space a new pane of `kind` asked from pane `from` goes into
+/// before it splits a pane (UX J1): `from` itself when it is untouched;
+/// else the nearest to where it would go, its column first (below `from`,
+/// nearest first, then above it; another column from its top), then the
+/// columns to its right, nearest first, then those to its left. Asked from
+/// a column's tag, that column alone, as acme puts the pane there; from
+/// the workspace's, no pane is the asker. None for New and 9P's pane/new,
+/// which make it.
+pub fn freeSpace(p: *Pardes, from: usize, kind: NewPane) ?Free {
+ const v = p.view();
+ if (kind == .scratch or kind == .fs or v.ncol == 0) return null;
+ const at = findPane(p, from);
+ if (at != null and !p.exec_header) if (p.panes[from]) |asker| if (Trail.untouched(p, asker)) return .{ .pane = from };
+ const c0 = columnFor(p, from, kind);
+ for (0..if (p.exec_column != null) 1 else v.ncol) |i| {
+ const c = if (c0 + i < v.ncol) c0 + i else v.ncol - 1 - i;
+ const col = v.cols[c].panes[0..v.cols[c].n];
+ if (col.len == 0) return .{ .column = c };
+ const below = if (at) |f| (if (f.col == c) f.idx + 1 else 0) else 0;
+ for (0..col.len) |j| {
+ const k = col[if (j < col.len - below) below + j else col.len - 1 - j];
+ const pane = p.panes[k] orelse continue;
+ if (Trail.untouched(p, pane)) return .{ .pane = k };
+ }
+ }
+ return null;
+}
+
+/// New pane `id` in untouched pane `k`'s place (UX J1), with its rows and
+/// weight; `k` closes at the step's end (Pardes.unplaced), once whatever
+/// made `id` is done with it. A file takes its number too, `@pN` and the
+/// 9P state its scripts hold, as a walk step's file does (Trail.show): `k`
+/// then closes never logged, and the file is a revision on from its text,
+/// so that nothing a worker was asked of it lands on this one. Any other
+/// pane keeps its own: a shell's spawn and a kind's jobs went to the host
+/// by it as the pane was made; a Zerox twin's revision is its text's.
+fn takePane(p: *Pardes, k: usize, id: usize) void {
+ const was = p.panes[k].?;
+ const now = p.panes[id].?;
+ replacePane(p, k, id);
+ p.unplaced.set(k);
+ if (!Trail.isFile(now) or now.file.?.twin != 0) return;
+ std.mem.swap(u32, &was.serial, &now.serial);
+ std.mem.swap(@TypeOf(was.fs), &was.fs, &now.fs);
+ now.file.?.revision = was.file.?.revision +% 1;
+ now.file.?.saved_revision = now.file.?.revision;
+ pardes.ctlfs.events.noteLog(p, .rename, now);
+}
+
/// acme's makenewwindow column (util.c:456-467): the column a command came
/// from (its tag's), else the active column, else the keyboard's pane's,
/// else the asking pane's.
@@ -2301,3 +2380,199 @@ test "a new pane goes below the rows a pane's text takes, a wrapped line's each
try std.testing.expect(p.view().active != a);
try std.testing.expect(p.view().rects[a].h -| pane.tag_rows >= used);
}
+
+/// UX J1's sessions: a directory of files of 100 lines, a.zig to g.zig,
+/// the session's first pane `/test.txt`, jumps walking.
+const FreeFixture = struct {
+ p: *Pardes,
+ tmp: std.testing.TmpDir,
+ dir_buf: [std.Io.Dir.max_path_bytes]u8 = undefined,
+ dir: []const u8 = "",
+
+ fn init(f: *FreeFixture, cols: u16, rows: u16) !void {
+ f.tmp = std.testing.tmpDir(.{});
+ errdefer f.tmp.cleanup();
+ var text: [100 * 9]u8 = undefined;
+ var w: std.Io.Writer = .fixed(&text);
+ for (1..101) |n| try w.print("line {d}\n", .{n});
+ for ("abcdefg") |name| try f.tmp.dir.writeFile(std.testing.io, .{ .sub_path = &.{ name, '.', 'z', 'i', 'g' }, .data = w.buffered() });
+ f.dir = f.dir_buf[0..try f.tmp.dir.realPath(std.testing.io, &f.dir_buf)];
+ f.p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = cols, .rows = rows });
+ errdefer f.p.deinit();
+ _ = try f.p.setTestFile("first\n");
+ f.p.settings.jumps = .walk;
+ }
+
+ fn deinit(f: *FreeFixture) void {
+ f.p.deinit();
+ f.tmp.cleanup();
+ }
+
+ /// A pane made at `idx` of column `c` and laid there by hand: a +New
+ /// (`held` false), or a held file of the directory's.
+ fn paneAt(f: *FreeFixture, c: usize, idx: usize, held: bool) !usize {
+ const p = f.p;
+ const id = p.freeSlot().?;
+ if (held) {
+ const pane = try p.newDocPane(id);
+ pane.file = .{ .path = try std.Io.Dir.path.join(p.gpa, &.{ f.dir, "held.txt" }), .content = try p.gpa.dupe(u8, "held\n"), .history = try panes.File.History.create(p.gpa) };
+ Trail.keep(pane);
+ } else _ = try panes.newScratch(p, 0, id, .scratch);
+ insert(p, c, idx, id);
+ p.sync();
+ return id;
+ }
+
+ /// A Look from pane `id` at `name`.zig:`line`; the pane it landed in.
+ fn look(f: *FreeFixture, id: usize, name: u8, line: usize) usize {
+ var buf: [std.Io.Dir.max_path_bytes + 16]u8 = undefined;
+ pardes.look.lookAt(f.p, id, std.fmt.bufPrint(&buf, "{s}/{c}.zig:{d}", .{ f.dir, name, line }) catch unreachable);
+ f.p.sync();
+ return f.p.view().active;
+ }
+
+ fn count(f: *const FreeFixture) usize {
+ var n: usize = 0;
+ for (f.p.panes) |slot| n += @intFromBool(slot != null);
+ return n;
+ }
+};
+
+test "free space first (UX J1): a held pane's reader takes the untouched +New nearest it, in its column below then above, then the columns to its right, then to its left, each keeping its number and rows; with none it splits a pane as before; an empty column is taken whole before a split" {
+ var f: FreeFixture = .{ .p = undefined, .tmp = undefined };
+ try f.init(150, 45);
+ defer f.deinit();
+ const p = f.p;
+ _ = insertColumn(p, 0, false).?;
+ _ = insertColumn(p, 1, false).?;
+ // Column 0: the first pane, a +New; column 1: a +New, the held pane,
+ // a +New; column 2: a +New.
+ const left = try f.paneAt(0, 1, false);
+ const above = try f.paneAt(1, 0, false);
+ const held = try f.paneAt(1, 1, true);
+ const below = try f.paneAt(1, 2, false);
+ const right = try f.paneAt(2, 0, false);
+ const n = f.count();
+ for ([_]usize{ below, above, right, left }, 0..) |want, i| {
+ const serial = p.panes[want].?.serial;
+ const rect = p.view().rects[want];
+ const reader = f.look(held, "abcd"[i], 10);
+ // In its place, its number, its rows; the +New gone.
+ try std.testing.expect(p.panes[want] == null);
+ try std.testing.expectEqual(serial, p.panes[reader].?.serial);
+ try std.testing.expectEqual(rect.y, p.view().rects[reader].y);
+ try std.testing.expectEqual(rect.x, p.view().rects[reader].x);
+ try std.testing.expectEqual(n, f.count());
+ try std.testing.expectEqual(p.panes[held].?.serial, p.panes[reader].?.trail.steps[0].owner);
+ try std.testing.expectEqual("abcd"[i], std.Io.Dir.path.basename(p.panes[reader].?.file.?.path)[0]);
+ // Kept: the next jump makes a new reader.
+ Trail.keep(p.panes[reader].?);
+ }
+ // No free space: placed as before (readerPlace), the held pane too
+ // short to halve: at the bottom of the next column, splitting it.
+ const split = f.look(held, 'e', 20);
+ try std.testing.expectEqual(n + 1, f.count());
+ try std.testing.expectEqual(@as(usize, 2), findPane(p, split).?.col);
+ try std.testing.expectEqual(@as(usize, 2), p.view().cols[2].n);
+ // An empty column, right of them all: the next reader takes it whole,
+ // the held pane keeping its rows.
+ Trail.keep(p.panes[split].?);
+ const c = insertColumn(p, 2, false).?;
+ p.sync();
+ const kept = p.view().rects[held];
+ const whole = f.look(held, 'f', 30);
+ try std.testing.expectEqual(c, findPane(p, whole).?.col);
+ try std.testing.expectEqual(@as(usize, 1), p.view().cols[c].n);
+ try std.testing.expectEqual(kept, p.view().rects[held]);
+}
+
+test "free space first (UX J1): a jump from an untouched +New reads in it, the same pane by its number, its trail starting at the file; under Jumps new-pane it opens in it the same way; a +New typed into and emptied, kept, or held by a 9P open (answered with it, or one of its files open) is never free space" {
+ var f: FreeFixture = .{ .p = undefined, .tmp = undefined };
+ try f.init(120, 40);
+ defer f.deinit();
+ const p = f.p;
+ // Walking: the +New is the file now, as a reading pane's step makes it.
+ const scratch = try f.paneAt(0, 1, false);
+ const serial = p.panes[scratch].?.serial;
+ const n = f.count();
+ const into = f.look(scratch, 'a', 12);
+ try std.testing.expectEqual(serial, p.panes[into].?.serial);
+ try std.testing.expectEqual(n, f.count());
+ try std.testing.expect(Trail.reading(p, p.panes[into].?));
+ try std.testing.expectEqual(@as(u8, 1), p.panes[into].?.trail.n);
+ try std.testing.expectEqual(@as(u32, 12), p.panes[into].?.trail.steps[0].place.line);
+ // Under Jumps new-pane: the same, placement not a walk.
+ p.settings.jumps = .@"new-pane";
+ const other = try f.paneAt(0, 2, false);
+ const other_serial = p.panes[other].?.serial;
+ pardes.exec.runBuiltin(p, .Keep, into, "Keep", null);
+ const opened = f.look(other, 'b', 3);
+ try std.testing.expectEqual(other_serial, p.panes[opened].?.serial);
+ try std.testing.expectEqual(n + 1, f.count());
+ try std.testing.expectEqualStrings("b.zig", std.Io.Dir.path.basename(p.panes[opened].?.file.?.path));
+ p.settings.jumps = .walk;
+ // Never free space: typed into and emptied again, kept, leased.
+ const typed = try f.paneAt(0, 3, false);
+ p.view().active = typed;
+ for ("ix") |ch| p.update(.{ .key = .{ .cp = ch, .text = &[_]u8{ch} } });
+ p.update(.{ .key = .{ .cp = pardes.Key.escape } });
+ p.update(.{ .key = .{ .cp = 'u', .text = "u" } });
+ try std.testing.expectEqual(@as(usize, 0), p.panes[typed].?.file.?.content.len);
+ const kept = try f.paneAt(0, 4, false);
+ Trail.keep(p.panes[kept].?);
+ const leased = try f.paneAt(0, 5, false);
+ p.fs.opens[0] = .{ .node = 1 };
+ p.fs.opens[0].results.list[0] = p.panes[leased].?.serial;
+ p.fs.opens[0].results.len = 1;
+ p.fs.opens[0].results.wrote = true;
+ // ...and one whose own file a 9P client holds open (a script's look
+ // at it): a script's pane/new stays its own.
+ const held_open = try f.paneAt(0, 6, false);
+ p.fs.opens[1] = .{ .node = pardes.ctlfs.Node.of(p.panes[held_open].?.serial, .look) };
+ p.fs.opens_len = 2;
+ defer p.fs.opens[0] = .{};
+ defer p.fs.opens[1] = .{};
+ for ([_]usize{ typed, kept, leased, held_open }) |k| try std.testing.expect(!Trail.untouched(p, p.panes[k].?));
+ try std.testing.expect(freeSpace(p, 0, .doc) == null);
+ try std.testing.expect(freeSpace(p, 0, .reader) == null);
+}
+
+test "free space first (UX J1): a command's output and a Term take an untouched +New's place, the asking one first, each by a number of its own; New and 9P's pane/new never do" {
+ if (pardes.Term.ops == null) return error.SkipZigTest; // a command pane's terminal
+ var f: FreeFixture = .{ .p = undefined, .tmp = undefined };
+ try f.init(120, 40);
+ defer f.deinit();
+ const p = f.p;
+ _ = insertColumn(p, 0, false).?;
+ // A +New in the last column, where a command's output goes.
+ const last = try f.paneAt(1, 0, false);
+ const rect = p.view().rects[last];
+ const out = pardes.exec.runCommand(p, 0, "true").?;
+ p.sync();
+ try std.testing.expect(p.panes[last] == null);
+ try std.testing.expect(p.panes[out].?.command != null);
+ try std.testing.expectEqual(rect, p.view().rects[out]);
+ // A Term run from an untouched +New is in its place.
+ const asker = try f.paneAt(0, 1, false);
+ const at = p.view().rects[asker];
+ const n = f.count();
+ pardes.exec.runBuiltin(p, .Term, asker, "Term", null);
+ p.sync();
+ try std.testing.expectEqual(n, f.count());
+ try std.testing.expect(p.panes[asker] == null);
+ try std.testing.expect(p.panes[p.view().active].?.isTerminal());
+ try std.testing.expectEqual(at, p.view().rects[p.view().active]);
+ // New makes free space, and 9P's pane/new: neither takes it.
+ const before = f.count();
+ pardes.exec.runBuiltin(p, .New, 0, "New", null);
+ p.sync();
+ const scratch = p.view().active;
+ try std.testing.expect(Trail.untouched(p, p.panes[scratch].?));
+ pardes.exec.runBuiltin(p, .New, scratch, "New", null);
+ p.sync();
+ try std.testing.expectEqual(before + 2, f.count());
+ panes.newScratchFor(p, scratch, .fs);
+ p.sync();
+ try std.testing.expectEqual(before + 3, f.count());
+ try std.testing.expect(p.panes[scratch] != null);
+}
diff --git a/core/look.zig b/core/look.zig
index f9dcfbc3..41c59cf3 100644
--- a/core/look.zig
+++ b/core/look.zig
@@ -433,12 +433,15 @@ pub fn runSearch(p: *Pardes, id: usize, pat_raw: []const u8, start: SearchStart,
// a builtin's argument comes trimmed already.
const pat = std.mem.trimEnd(u8, pat_raw, "\r\n");
if (std.mem.trim(u8, pat, " \t").len == 0) return 0;
- const arena = p.scratch.allocator();
// where the pane lives: a file's directory, a shell's cwd — the
// directory the results buffer is named in. From a column's or the
// workspace's tag, the session's.
const dir = if (p.exec_header) p.sessionDir() else Pardes.paneDir(pane);
- const out = try @import("memory.zig").unfilled(arena, search_text_output_bytes);
+ // The gpa's, not the step's arena: 9P requests come between steps,
+ // and a word looked at twice in one burst of them asked that arena for
+ // a node of 75 MB (core/fuzz.zig's 9P seed 610).
+ const out = try @import("memory.zig").unfilled(p.gpa, search_text_output_bytes);
+ defer p.gpa.free(out);
var out_len: usize = 0;
var nrows: usize = 0;
var anchor: ?usize = null;
@@ -1514,7 +1517,8 @@ pub const Landed = union(enum) { none, shown, opened: usize };
/// SPEC §6.1). With `Jumps walk`: a held pane showing the file is focused
/// and nothing replaced; the asking pane showing it moves in it (a step
/// when it is reading); a reading pane steps in place, a held one steps
-/// its reader (Trail.zig), made under it on its first jump. With
+/// its reader (Trail.zig), made on its first jump in free space or under
+/// it (layout.placeNew), an untouched pane's in its place. With
/// `Jumps new-pane` as before the walk: a pane showing the file focused,
/// else a new one.
pub fn open(p: *Pardes, from: usize, path: []const u8, at: Spot, how: How) Landed {
@@ -1568,8 +1572,12 @@ fn openNew(p: *Pardes, from: usize, path: []const u8, at: Spot, kind: layout.New
};
nt.body.cur_col = columnOn(nt, nt.body.cur_row, at.col);
// A reader's walk (its owner's word, its place) is in its tag before
- // it is placed: the rows it is given are for the tag it shows.
- if (kind == .reader) nt.trail = Trail.reader(p.panes[from].?.serial, path, at);
+ // it is placed: the rows it is given are for the tag it shows. From an
+ // untouched pane, whose place it takes (UX J1), its place alone.
+ if (kind == .reader) {
+ const asker = p.panes[from].?;
+ nt.trail = Trail.reader(if (Trail.untouched(p, asker)) null else asker.serial, path, at);
+ }
const failures = p.fs.failures;
layout.placeNew(p, from, from, free, kind);
// Refused a place: that is the look's one failure, not a miss of its
diff --git a/docs/typ/reference.typ b/docs/typ/reference.typ
index 6b90fcdc..996906ac 100644
--- a/docs/typ/reference.typ
+++ b/docs/typ/reference.typ
@@ -1292,7 +1292,16 @@ by the build (docs/typ/command-line.txt), so it is what the binary says.
= Placement <placement>
-A new pane goes in the column whose tag asked, else the active column (last typed or left-clicked in,
+Free space first: a new pane takes an untouched `+New` (its body empty and
+never typed into, still so named, not kept, no #file("exec") or #file("look")
+open holding it) or an empty column before it splits a pane: the asking
+pane itself when it is one, else the nearest, in its column (below it, then
+above), then the columns to its right, then those to its left. A file opened
+there keeps the `+New`'s number; a picker asked from one previews in it, and
+Esc gives it back empty. #word("New") and #file("pane/new") make free space,
+never take it.
+
+Else a new pane goes in the column whose tag asked, else the active column (last typed or left-clicked in,
dropped into, its tag given the keyboard, or given the last new pane),
never a new column. An empty column it takes whole; #word("New") and
#file("pane/new") take the bottom half of the column's last pane; a pane
diff --git a/test/snapshots/diffstack.golden b/test/snapshots/diffstack.golden
index cd4ce739..68c58062 100644
--- a/test/snapshots/diffstack.golden
+++ b/test/snapshots/diffstack.golden
@@ -4,16 +4,6 @@
|$ /tmp/pardes-snap/diffstack/cwd Term+bash Save Mode Filter Collapse Del
| $ cat change.patch | $(readlink /proc/$PPID/exe) -
| $
-| /tmp/pardes-snap/diffstack/cwd/+Diff Save Term Diff Collapse LocationsConfig Del
-| a.zig:3
-| const S = struct {
-| a.zig:5 *
-| fn f() void {
-| - c();
-| + a();
-| b();
-| + log();
-| }
|
|
|
@@ -24,11 +14,21 @@
|
|
|
-| /tmp/pardes-snap/diffstack/cwd/+New Save Term Collapse Follow Del
-| 1
|
|
|
+|
+|
+|
+| /tmp/pardes-snap/diffstack/cwd/+Diff Save Term Diff Collapse LocationsConfig Del
+| a.zig:3
+| const S = struct {
+| a.zig:5 *
+| fn f() void {
+| - c();
+| + a();
+| b();
+| + log();
| /tmp/pardes-snap/diffstack/cwd
== style diff-stack-colours grid=100x31
|0: 0-1 d,#1d2824, 2-99 #b2c3b8,#1d2824,
@@ -36,29 +36,29 @@
|2: 0-1 #000000,#add38a, 2-32 #becfc4,#314738, 33-42 #dfbce5,#314738, 43-99 #becfc4,#314738,
|3: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410,
|4: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410,
-|5: 0-1 d,#496656, 2-32 #b2c3b8,#1d2824, 33-38 #d3b0d9,#1d2824, 39-99 #b2c3b8,#1d2824,
-|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #59675c,#0d1410,
-|7: 0-0 d,#608269, 1-2 d,#0d1410, 3-99 #59675c,#0d1410,
-|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #59675c,#0d1410,
-|9: 0-0 d,#608269, 1-6 d,#0d1410, 7-9 #c9a7ed,#0d1410, 10-99 #e5eee5,#0d1410,
-|10: 0-0 d,#608269, 1-1 d,#0d1410, 2-2 #f1a39b,#0d1410,b 3-10 #f1a39b,#0d1410, 11-11 #e5eee5,#453832, 12-99 #e5eee5,#0d1410,
-|11: 0-0 d,#608269, 1-1 d,#0d1410, 2-2 #b6ce94,#0d1410,b 3-10 #b6ce94,#0d1410, 11-11 #e5eee5,#364131, 12-99 #e5eee5,#0d1410,
-|12: 0-0 d,#608269, 1-10 d,#0d1410, 11-99 #e5eee5,#0d1410,
-|13: 0-0 d,#608269, 1-1 d,#0d1410, 2-2 #b6ce94,#171f18,b 3-10 #b6ce94,#171f18, 11-99 #e5eee5,#171f18,
-|14: 0-0 d,#608269, 1-6 d,#0d1410, 7-99 #e5eee5,#0d1410,
+|5: 0-0 d,#608269, 1-99 d,#0d1410,
+|6: 0-0 d,#608269, 1-99 d,#0d1410,
+|7: 0-0 d,#608269, 1-99 d,#0d1410,
+|8: 0-0 d,#608269, 1-99 d,#0d1410,
+|9: 0-0 d,#608269, 1-99 d,#0d1410,
+|10: 0-0 d,#608269, 1-99 d,#0d1410,
+|11: 0-0 d,#608269, 1-99 d,#0d1410,
+|12: 0-0 d,#608269, 1-99 d,#0d1410,
+|13: 0-0 d,#608269, 1-99 d,#0d1410,
+|14: 0-0 d,#608269, 1-99 d,#0d1410,
|15: 0-0 d,#608269, 1-99 d,#0d1410,
|16: 0-0 d,#608269, 1-99 d,#0d1410,
|17: 0-0 d,#608269, 1-99 d,#0d1410,
|18: 0-0 d,#608269, 1-99 d,#0d1410,
|19: 0-0 d,#608269, 1-99 d,#0d1410,
|20: 0-0 d,#608269, 1-99 d,#0d1410,
-|21: 0-0 d,#608269, 1-99 d,#0d1410,
-|22: 0-0 d,#608269, 1-99 d,#0d1410,
-|23: 0-0 d,#608269, 1-99 d,#0d1410,
-|24: 0-0 d,#608269, 1-99 d,#0d1410,
-|25: 0-1 d,#496656, 2-32 #b2c3b8,#1d2824, 33-37 #d3b0d9,#1d2824, 38-99 #b2c3b8,#1d2824,
-|26: 0-0 d,#608269, 1-4 d,#0d1410, 5-99 #59675c,#0d1410,
-|27: 0-0 d,#608269, 1-99 d,#0d1410,
-|28: 0-0 d,#608269, 1-99 d,#0d1410,
-|29: 0-0 d,#608269, 1-99 d,#0d1410,
+|21: 0-1 d,#496656, 2-32 #b2c3b8,#1d2824, 33-38 #d3b0d9,#1d2824, 39-99 #b2c3b8,#1d2824,
+|22: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #59675c,#0d1410,
+|23: 0-0 d,#608269, 1-2 d,#0d1410, 3-99 #59675c,#0d1410,
+|24: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #59675c,#0d1410,
+|25: 0-0 d,#608269, 1-6 d,#0d1410, 7-9 #c9a7ed,#0d1410, 10-99 #e5eee5,#0d1410,
+|26: 0-0 d,#608269, 1-1 d,#0d1410, 2-2 #f1a39b,#0d1410,b 3-10 #f1a39b,#0d1410, 11-11 #e5eee5,#453832, 12-99 #e5eee5,#0d1410,
+|27: 0-0 d,#608269, 1-1 d,#0d1410, 2-2 #b6ce94,#0d1410,b 3-10 #b6ce94,#0d1410, 11-11 #e5eee5,#364131, 12-99 #e5eee5,#0d1410,
+|28: 0-0 d,#152019, 1-10 d,#0d1410, 11-99 #e5eee5,#0d1410,
+|29: 0-0 d,#152019, 1-1 d,#0d1410, 2-2 #b6ce94,#171f18,b 3-10 #b6ce94,#171f18, 11-99 #e5eee5,#171f18,
|30: 0-1 d,#1d2824, 2-99 #b2c3b8,#1d2824,
diff --git a/test/snapshots/look-fd-deep.golden b/test/snapshots/look-fd-deep.golden
index dc1e34f0..37fa9fe1 100644
--- a/test/snapshots/look-fd-deep.golden
+++ b/test/snapshots/look-fd-deep.golden
@@ -30,11 +30,11 @@
|
|
| /tmp/pardes-snap/look-fd-deep/cwd/a
-== snap fd-path-looked grid=100x31 cursor=7,12
-|11: ‹@p1 › /tmp/pardes-snap/look-fd-deep/cwd/a/b/c.txt Keep Save Term Collapse Follow Del
-|12: 1 deep-marker
+== snap fd-path-looked grid=100x31 cursor=7,22
+|21: ‹@p1 › /tmp/pardes-snap/look-fd-deep/cwd/a/b/c.txt Keep Save Term Collapse Follow Del
+|22: 1 deep-marker
|30: /tmp/pardes-snap/look-fd-deep/cwd/a/b/c.txt:1
-== snap ls-name-looked grid=100x31 cursor=7,12
-|11: ‹@p1 › c.txt:1 › /tmp/pardes-snap/look-fd-deep/cwd/a/top.txt Keep Save Term Collapse Follow Del
-|12: 1 top-marker
+== snap ls-name-looked grid=100x31 cursor=7,22
+|21: ‹@p1 › c.txt:1 › /tmp/pardes-snap/look-fd-deep/cwd/a/top.txt Keep Save Term Collapse Follow Del
+|22: 1 top-marker
|30: /tmp/pardes-snap/look-fd-deep/cwd/a/top.txt:1
diff --git a/test/snapshots/nested.golden b/test/snapshots/nested.golden
index 5a62e122..2fe89a60 100644
--- a/test/snapshots/nested.golden
+++ b/test/snapshots/nested.golden
@@ -1,4 +1,4 @@
-== snap file-arg grid=100x31 cursor=7,12
+== snap file-arg grid=100x31 cursor=7,22
| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config History Debug Exit
| New Term Find Grep Joincol Delcol
|$ /tmp/pardes-snap/nested/cwd Term+bash Save Mode Filter Collapse Del
@@ -10,22 +10,22 @@
|
|
|
-| ‹@p1 › /tmp/pardes-snap/nested/cwd/nested.txt Keep Save Term Collapse Follow Del
-| 1 hello-from-nested
-| 2 second-nested-line
-| ~
|
|
|
|
|
|
-| /tmp/pardes-snap/nested/cwd/+New Save Term Collapse Follow Del
-| 1
|
|
|
|
+| ‹@p1 › /tmp/pardes-snap/nested/cwd/nested.txt Keep Save Term Collapse Follow Del
+| 1 hello-from-nested
+| 2 second-nested-line
+| ~
+|
+|
|
|
|
@@ -62,15 +62,12 @@
|
|
| /tmp/pardes-snap/nested/cwd
-== snap dir-arg grid=100x31 cursor=7,6
+== snap dir-arg grid=100x31 cursor=7,22
| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config History Debug Exit
| New Term Find Grep Joincol Delcol
|$ /tmp/pardes-snap/nested/cwd Term+bash Save Mode Filter Collapse Del
| $ $(readlink /proc/$PPID/exe) nestdir
| $
-| /tmp/pardes-snap/nested/cwd/nestdir/ Get Term Collapse Del
-| 1 inside-nested.txt
-| ~
|
|
|
@@ -84,11 +81,14 @@
|
|
|
-| /tmp/pardes-snap/nested/cwd/+New Save Term Collapse Follow Del
-| 1
|
|
|
+| /tmp/pardes-snap/nested/cwd/nestdir/ Get Term Collapse Del
+| 1 inside-nested.txt
+| ~
+|
+|
|
|
|
diff --git a/test/snapshots/pagercolor.golden b/test/snapshots/pagercolor.golden
index d15c680d..beaaf7f5 100644
--- a/test/snapshots/pagercolor.golden
+++ b/test/snapshots/pagercolor.golden
@@ -105,15 +105,11 @@
|6: 3[m\n\033[1m+++ b/x\033[m\n\033[36m@@ -1 +1 @@\033[m\n\033[31m-old\033[m\n\033[32m+new\033[m\n' |
|7: $(readlink /proc/$PPID/exe) -
|8: $
-|9: /tmp/pardes-snap/pagercolor/cwd/+Diff-0123abc Save Term Diff Collapse LocationsConfig Del
-|10: commit 0123abc
-|11: x:1
-|12: -old
-|13: +new
-|33:
-|34:
-|37: /tmp/pardes-snap/pagercolor/cwd/+New Save Term Collapse Follow Del
-|38: 1
+|33: /tmp/pardes-snap/pagercolor/cwd/+Diff-0123abc Save Term Diff Collapse LocationsConfig Del
+|34: commit 0123abc
+|35: x:1
+|36: -old
+|37: +new
|41:
|42:
|45: /tmp/pardes-snap/pagercolor/cwd/+Pager Save Term Filter Collapse Del
@@ -122,15 +118,11 @@
|6: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410,
|7: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410,
|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410,
-|9: 0-1 d,#496656, 2-33 #b2c3b8,#1d2824, 34-47 #d3b0d9,#1d2824, 48-99 #b2c3b8,#1d2824,
-|10: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410,
-|11: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #59675c,#0d1410,
-|12: 0-0 d,#608269, 1-1 d,#0d1410, 2-2 #f1a39b,#1a1d18,b 3-99 #f8c082,#1a1d18,
-|13: 0-0 d,#608269, 1-1 d,#0d1410, 2-2 #b6ce94,#171f18,b 3-99 #b8d88a,#171f18,
-|33: 0-0 d,#608269, 1-99 d,#0d1410,
-|34: 0-0 d,#608269, 1-99 d,#0d1410,
-|37: 0-1 d,#496656, 2-33 #b2c3b8,#1d2824, 34-38 #d3b0d9,#1d2824, 39-99 #b2c3b8,#1d2824,
-|38: 0-0 d,#608269, 1-4 d,#0d1410, 5-99 #59675c,#0d1410,
+|33: 0-1 d,#496656, 2-33 #b2c3b8,#1d2824, 34-47 #d3b0d9,#1d2824, 48-99 #b2c3b8,#1d2824,
+|34: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410,
+|35: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #59675c,#0d1410,
+|36: 0-0 d,#608269, 1-1 d,#0d1410, 2-2 #f1a39b,#1a1d18,b 3-99 #f8c082,#1a1d18,
+|37: 0-0 d,#608269, 1-1 d,#0d1410, 2-2 #b6ce94,#171f18,b 3-99 #b8d88a,#171f18,
|41: 0-0 d,#608269, 1-99 d,#0d1410,
|42: 0-0 d,#608269, 1-99 d,#0d1410,
|45: 0-1 d,#496656, 2-33 #b2c3b8,#1d2824, 34-40 #d3b0d9,#1d2824, 41-99 #b2c3b8,#1d2824,
diff --git a/test/snapshots/psearch.golden b/test/snapshots/psearch.golden
index d7ca8a95..9f7eab39 100644
--- a/test/snapshots/psearch.golden
+++ b/test/snapshots/psearch.golden
@@ -34,14 +34,14 @@
|3: printf 'x MA''RK a\nzz\nx MA''RK b\nzz\nx MA''RK c\n' /MARK
== snap results grid=140x31 cursor=7,4
|3: printf 'x MA''RK a\nzz\nx MA''RK b\nzz\nx MA''RK c\n'
-|10: /tmp/pardes-snap/psearch/cwd/+Search Save Term Collapse Follow LocationsConfig Del
-|11: 1 @p1:2:3-6
-|12: 2 x MARK a
-|13: 3 @p1:4:3-6
-|14: 4 x MARK b
-|15: 5 @p1:6:3-6
-|16: 6 x MARK c
-|17: ~
+|21: /tmp/pardes-snap/psearch/cwd/+Search Save Term Collapse Follow LocationsConfig Del
+|22: 1 @p1:2:3-6
+|23: 2 x MARK a
+|24: 3 @p1:4:3-6
+|25: 4 x MARK b
+|26: 5 @p1:6:3-6
+|27: 6 x MARK c
+|28: ~
== style results grid=140x31
|0: 0-1 d,#1d2824, 2-139 #b2c3b8,#1d2824,
|1: 0-1 d,#887455, 2-139 #becfc4,#314738,
@@ -53,32 +53,32 @@
|7: 0-0 d,#608269, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410,
|8: 0-0 d,#608269, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410,
|9: 0-0 d,#608269, 1-139 d,#0d1410,
-|10: 0-1 d,#496656, 2-30 #b2c3b8,#1d2824, 31-38 #d3b0d9,#1d2824, 39-139 #b2c3b8,#1d2824,
-|11: 0-0 d,#608269, 1-4 d,#0d1410, 5-139 #59675c,#0d1410,
-|12: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-8 #e5eee5,#0d1410, 9-12 #f7e4a5,#5e4923, 13-13 #f7e4a5,#0d1410, 14-139 #e5eee5,#0d1410,
-|13: 0-0 d,#608269, 1-4 d,#0d1410, 5-139 #59675c,#0d1410,
-|14: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-8 #e5eee5,#0d1410, 9-12 #f7e4a5,#5e4923, 13-13 #f7e4a5,#0d1410, 14-139 #e5eee5,#0d1410,
-|15: 0-0 d,#608269, 1-4 d,#0d1410, 5-139 #59675c,#0d1410,
-|16: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-8 #e5eee5,#0d1410, 9-12 #f7e4a5,#5e4923, 13-13 #f7e4a5,#0d1410, 14-139 #e5eee5,#0d1410,
-|17: 0-0 d,#608269, 1-4 d,#0d1410, 5-139 #59675c,#0d1410,
+|10: 0-0 d,#608269, 1-139 d,#0d1410,
+|11: 0-0 d,#608269, 1-139 d,#0d1410,
+|12: 0-0 d,#608269, 1-139 d,#0d1410,
+|13: 0-0 d,#608269, 1-139 d,#0d1410,
+|14: 0-0 d,#608269, 1-139 d,#0d1410,
+|15: 0-0 d,#608269, 1-139 d,#0d1410,
+|16: 0-0 d,#608269, 1-139 d,#0d1410,
+|17: 0-0 d,#608269, 1-139 d,#0d1410,
|18: 0-0 d,#608269, 1-139 d,#0d1410,
|19: 0-0 d,#608269, 1-139 d,#0d1410,
|20: 0-0 d,#608269, 1-139 d,#0d1410,
-|21: 0-1 d,#496656, 2-30 #b2c3b8,#1d2824, 31-35 #d3b0d9,#1d2824, 36-139 #b2c3b8,#1d2824,
+|21: 0-1 d,#496656, 2-30 #b2c3b8,#1d2824, 31-38 #d3b0d9,#1d2824, 39-139 #b2c3b8,#1d2824,
|22: 0-0 d,#608269, 1-4 d,#0d1410, 5-139 #59675c,#0d1410,
-|23: 0-0 d,#608269, 1-139 d,#0d1410,
-|24: 0-0 d,#608269, 1-139 d,#0d1410,
-|25: 0-0 d,#608269, 1-139 d,#0d1410,
-|26: 0-0 d,#608269, 1-139 d,#0d1410,
-|27: 0-0 d,#608269, 1-139 d,#0d1410,
-|28: 0-0 d,#608269, 1-139 d,#0d1410,
+|23: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-8 #e5eee5,#0d1410, 9-12 #f7e4a5,#5e4923, 13-13 #f7e4a5,#0d1410, 14-139 #e5eee5,#0d1410,
+|24: 0-0 d,#608269, 1-4 d,#0d1410, 5-139 #59675c,#0d1410,
+|25: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-8 #e5eee5,#0d1410, 9-12 #f7e4a5,#5e4923, 13-13 #f7e4a5,#0d1410, 14-139 #e5eee5,#0d1410,
+|26: 0-0 d,#608269, 1-4 d,#0d1410, 5-139 #59675c,#0d1410,
+|27: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-8 #e5eee5,#0d1410, 9-12 #f7e4a5,#5e4923, 13-13 #f7e4a5,#0d1410, 14-139 #e5eee5,#0d1410,
+|28: 0-0 d,#608269, 1-4 d,#0d1410, 5-139 #59675c,#0d1410,
|29: 0-0 d,#608269, 1-139 d,#0d1410,
|30: 0-1 d,#1d2824, 2-139 #b2c3b8,#1d2824,
== snap second grid=140x31 cursor=7,6
== snap back grid=140x31 cursor=7,4
-== snap nomatch grid=140x31 cursor=7,13
-|24: /tmp/pardes-snap/psearch/cwd/+Search Save Term Collapse Follow LocationsConfig Del
-|25: 1
+== snap nomatch grid=140x31 cursor=7,24
+|10: /tmp/pardes-snap/psearch/cwd/+Search Save Term Collapse Follow LocationsConfig Del
+|11: 1
|30: /tmp/pardes-snap/psearch/cwd/+Search:3
== snap ttyinert grid=140x31 cursor=4,9
|2: $ /tmp/pardes-snap/psearch/cwd Term+bash Save Mode Filter Collapse Del
diff --git a/test/snapshots/ttyhelp.golden b/test/snapshots/ttyhelp.golden
index 7217e5ba..d7c9f6a8 100644
--- a/test/snapshots/ttyhelp.golden
+++ b/test/snapshots/ttyhelp.golden
@@ -30,38 +30,20 @@
|
|
| /tmp/pardes-snap/ttyhelp/cwd
-== snap helped grid=100x31 cursor=7,6
-|5: /tmp/pardes-snap/ttyhelp/cwd/+Help Save Term Collapse Follow Del
-|6: 1 pardes builtins: each one's keys and its name, then what it does. Run one by its keys, or by↩
-|7: its name anywhere: B2 on the word, Exec <name>, a line of a ctl file, or `pardes do <name>`↩
-|8: from a shell. `Help <name>` shows one builtin alone; `Help <keys>` (or SPC, those keys, the↩
-|9: n ?) the builtins under SPC and those keys.
-|10: 2
-|11: 3 SPC ' Resume
-|12: 4 Reopen the last picker as it was: its rows, marks, cursor and query.
-|13: 5 In the tag of the pane its Enter lands in from this one: this pane if it reads, else its rea↩
-|14: der. `SPC '`.
-|15: 6
-|16: 7 SPC ? Help topbar
-|17: 8 Show every builtin with its keys and documentation, or one builtin's alone.
-|18: 9 `Help <name>`: that builtin alone, its keys spelled out, what it acts on and its line for a ↩
-|19: shell (`Help Diff`); a setting or an addon's word the same. `Help <keys>`: the builtins unde↩
-|20: r SPC and those keys (`Help l`, as `SPC l ?` shows them). Each fills the one +Help: a second
+== snap helped grid=100x31 cursor=7,22
+|21: /tmp/pardes-snap/ttyhelp/cwd/+Help Save Term Collapse Follow Del
+|22: 1 pardes builtins: each one's keys and its name, then what it does. Run one by its keys, or by↩
+|23: its name anywhere: B2 on the word, Exec <name>, a line of a ctl file, or `pardes do <name>`↩
+|24: from a shell. `Help <name>` shows one builtin alone; `Help <keys>` (or SPC, those keys, the↩
+|25: n ?) the builtins under SPC and those keys.
+|26: 2
+|27: 3 SPC ' Resume
+|28: 4 Reopen the last picker as it was: its rows, marks, cursor and query.
+|29: 5 In the tag of the pane its Enter lands in from this one: this pane if it reads, else its rea
|30: ✓ @p1 Help 1 message · SPC h m
-== snap leaderworks grid=100x31 cursor=12,5
-|5: ^ Help tutor 1/1
-|6: ▶ SPC h t Tutor help │ t Tutor
-|7: │ Open the tutor, a document to work through.
-|8: │ keys SPC h t
-|9: │
-|10: 1 pardes builtins: each one's keys and its name, then what it does. Run one by its keys, or by↩
-|11: its name anywhere: B2 on the word, Exec <name>, a line of a ctl file, or `pardes do <name>`↩
-|12: from a shell. `Help <name>` shows one builtin alone; `Help <keys>` (or SPC, those keys, the↩
-|13: n ?) the builtins under SPC and those keys.
-|14: 2
-|15: 3 SPC ' Resume
-|16: 4 Reopen the last picker as it was: its rows, marks, cursor and query.
-|17: 5 In the tag of the pane its Enter lands in from this one: this pane if it reads, else its rea↩
-|18: der. `SPC '`.
-|19: 6
-|20: 7 SPC ? Help topbar
+== snap leaderworks grid=100x31 cursor=12,17
+|17: ^ Help tutor 1/1
+|18: ▶ SPC h t Tutor help │ t Tutor
+|19: │ Open the tutor, a document to work through.
+|20: │ keys SPC h t
+|21: │