summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/perf.zig28
-rw-r--r--test/snapshots/find.golden4
-rw-r--r--test/snapshots/fsearch.golden2
3 files changed, 27 insertions, 7 deletions
diff --git a/test/perf.zig b/test/perf.zig
index 2b5f7dfa..ad873691 100644
--- a/test/perf.zig
+++ b/test/perf.zig
@@ -86,12 +86,16 @@ const Op = enum {
/// the tag states' keys compare with (key-down's frames each draw
/// another place of the file).
rest_keys,
+ /// Ctrl-o from a list's landing onto its word (UX L'1): the list
+ /// reopened as it was left, its head and band drawn in the key's frame;
+ /// Esc back to rest and its frame (two keys, two frames).
+ walk_pop,
/// Run only when named (`--op`): a full run, its cells and the sums a
/// gate takes over them (perfops' "terminal on all") are as before.
fn named(o: Op) bool {
return switch (o) {
- .spc, .spc_down, .help_type, .describe, .rest_keys => true,
+ .spc, .spc_down, .help_type, .describe, .rest_keys, .walk_pop => true,
else => false,
};
}
@@ -118,6 +122,7 @@ const Op = enum {
.help_type => "help-type",
.describe => "describe",
.rest_keys => "rest-keys",
+ .walk_pop => "walk-pop",
};
}
};
@@ -622,7 +627,7 @@ fn measure(op: Op, fx: Fixture, path: []const u8, expected_bytes: usize, reps: u
switch (op) {
.image_frame => return measureImage(std.fs.path.dirname(path).?, samples, warmup),
.client_key_down, .client_edit_char, .client_delete_undo => return measureClient(op, path, reps),
- .spc, .spc_down, .help_type, .describe, .rest_keys => return measureTag(op, path, reps),
+ .spc, .spc_down, .help_type, .describe, .rest_keys, .walk_pop => return measureTag(op, path, reps),
else => {},
}
if (op == .open) {
@@ -677,7 +682,7 @@ fn measure(op: Op, fx: Fixture, path: []const u8, expected_bytes: usize, reps: u
const wheel_row = rect.y + pardes.BOX_H;
const t0 = nowNs();
switch (op) {
- .open, .image_frame, .client_key_down, .client_edit_char, .client_delete_undo, .spc, .spc_down, .help_type, .describe, .rest_keys => unreachable,
+ .open, .image_frame, .client_key_down, .client_edit_char, .client_delete_undo, .spc, .spc_down, .help_type, .describe, .rest_keys, .walk_pop => unreachable,
.render, .deep_selection => {},
.key_down => core.update(.{ .key = .{ .cp = 'j', .text = "j" } }),
.key_right => core.update(.{ .key = .{ .cp = 'l', .text = "l" } }),
@@ -691,7 +696,7 @@ fn measure(op: Op, fx: Fixture, path: []const u8, expected_bytes: usize, reps: u
_ = try frame(core);
const dt = nowNs() -| t0;
switch (op) {
- .open, .image_frame, .client_key_down, .client_edit_char, .client_delete_undo, .spc, .spc_down, .help_type, .describe, .rest_keys => unreachable,
+ .open, .image_frame, .client_key_down, .client_edit_char, .client_delete_undo, .spc, .spc_down, .help_type, .describe, .rest_keys, .walk_pop => unreachable,
.body_write => if (pane.file.?.content.len != before.len + 8 * body_chunk.len) return error.BodyWriteWasNotAppended,
.body_appends => if (pane.file.?.content.len != before.len + append_count * append_chunk_len) return error.BodyAppendsWereNotAppended,
.render, .deep_selection => if (pane.body.cur_row != before.row or pane.body.cur_col != before.col or pane.file.?.content.len != before.len)
@@ -790,8 +795,17 @@ fn measureTag(op: Op, path: []const u8, reps: usize) !Cell {
pump(core);
const id = filePane(core) orelse return error.OpenDidNotOpenFile;
core.view().active = id;
+ // A list of two places in the file, landed on its first (a reading
+ // pane's step): the list's word in its trail before the place.
+ if (op == .walk_pop) {
+ core.settings.jumps = .walk;
+ const rows = try std.fmt.allocPrint(gpa, "{s}:10:1 a\n{s}:20:1 b\n", .{ path, path });
+ defer gpa.free(rows);
+ pardes.Pick.open(core, id, .list, "Refs", "", rows);
+ }
const enter: []const Key = switch (op) {
.spc, .rest_keys => &.{},
+ .walk_pop => &.{.{ .cp = Key.enter }},
.spc_down => &.{ .{ .cp = ' ', .text = " " }, .{ .cp = Key.down } },
.help_type => &.{ .{ .cp = ' ', .text = " " }, .{ .cp = '?', .text = "?" } },
.describe => &.{ .{ .cp = ' ', .text = " " }, .{ .cp = 'h', .text = "h" }, .{ .cp = 'k', .text = "k" } },
@@ -806,8 +820,11 @@ fn measureTag(op: Op, path: []const u8, reps: usize) !Cell {
.help_type => &.{ .{ .cp = 'e', .text = "e" }, .{ .cp = Key.backspace } },
.describe => &.{ .{ .cp = 'g', .text = "g" }, .{ .cp = 'd', .text = "d" } },
.rest_keys => &.{ .{ .cp = 'j', .text = "j" }, .{ .cp = 'k', .text = "k" } },
+ .walk_pop => &.{ .{ .cp = 'o', .ctrl = true }, .{ .cp = Key.escape } },
else => unreachable,
};
+ const landed = core.panes[id].?.trail.cur;
+ if (op == .walk_pop and (landed == 0 or core.panes[id].?.trail.steps[landed - 1] != .list)) return error.ListDidNotLand;
const s = &core.view().tag_state;
for (0..warmup + samples.len) |n| {
const t0 = nowNs();
@@ -822,6 +839,8 @@ fn measureTag(op: Op, path: []const u8, reps: usize) !Cell {
if (!pardes.TagState.shown(core, core.view())) return error.LevelNotShown;
_ = try frame(core);
}
+ // The list reopened by the key itself, drawn in its frame.
+ if (op == .walk_pop and k.ctrl and pardes.Pick.live(core) == null) return error.ListNotReopened;
}
const dt = nowNs() -| t0;
const held = switch (op) {
@@ -830,6 +849,7 @@ fn measureTag(op: Op, path: []const u8, reps: usize) !Cell {
.help_type => s.kind == .help and s.field.len == 0 and s.nhits > 0,
.describe => s.kind == .describe and s.found,
.rest_keys => s.kind == .rest and s.root == null and core.panes[id].?.body.cur_row == 0,
+ .walk_pop => s.kind == .rest and core.panes[id].?.trail.cur == landed and core.panes[id].?.body.cur_row == 9,
else => unreachable,
};
if (!held) return error.TagStateLost;
diff --git a/test/snapshots/find.golden b/test/snapshots/find.golden
index e9a50dec..34333048 100644
--- a/test/snapshots/find.golden
+++ b/test/snapshots/find.golden
@@ -1,7 +1,7 @@
== snap group grid=120x41 cursor=7,3
| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config History Debug Exit
| New Term Find Grep Joincol Delcol
-| ␣ f ▸ c Config f Find g Grep h History n New r Recent s Save ↓ unroll · ? help
+| ␣ f ▸ c Config f Find g Grep h History l Lists n New r Recent s Save ↓ unroll · ? help
| 1 Find zqm
|
|
@@ -72,7 +72,7 @@
|7:
|8:
|9:
-|40: ✓ /tmp/pardes-snap/find/cwd/here.txt Find 1 message · SPC h m
+|40: ✓ C-o back to Find zqm 2/3 1 message · SPC h m
== snap nomatch grid=120x41 cursor=30,2
|2: ^ Find zqm 2/3 › ␣ f Find zzqq 0
|3: │ │ Walk Look Split Newcol Grep Edit Copy Keep Drop | Grep Recent Panes Symbols All Jumplist
diff --git a/test/snapshots/fsearch.golden b/test/snapshots/fsearch.golden
index 8fbf0221..6a70d3c4 100644
--- a/test/snapshots/fsearch.golden
+++ b/test/snapshots/fsearch.golden
@@ -113,7 +113,7 @@
|27: 11 l11
|28: 12 l12
|29:
-|30: · @p1 a copy of the terminal's text: Tab or B2 runs it; what the program draws next replaces it (Ctrl-b types to the program) 1 message · SPC h m
+|30: ✓ C-o back to /MARK/ 2/3 1 message · SPC h m
== snap n grid=180x31 cursor=97,27
|16: /tmp/pardes-snap/fsearch/cwd Term+bash Save Mode Filter Collapse Del ‹@p1 › +1 › /MARK/ 3/3 › /tmp/pardes-snap/fsearch/cwd/g.txt Keep Save Term Collapse Foll
|18: g.txt 1 l1