diff options
Diffstat (limited to 'test/process/tty_editing.zig')
| -rw-r--r-- | test/process/tty_editing.zig | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/test/process/tty_editing.zig b/test/process/tty_editing.zig index 53e1da1e..cb903bd6 100644 --- a/test/process/tty_editing.zig +++ b/test/process/tty_editing.zig @@ -365,13 +365,16 @@ fn pipe(gpa: std.mem.Allocator, exe: [:0]const u8) !void { fn chordcut(gpa: std.mem.Allocator, exe: [:0]const u8) !void { var t = try Tty.init(gpa, exe, "chordcut"); defer t.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + try t.config("Jumps new-pane"); try t.lines("f.txt", 5, ""); try t.lines("g.txt", 2, ""); // The narrow-window fallback splits below the source shell and leaves the // unrelated right column untouched. Give the caller enough cells that the selected // `echo B''OO g.txt` remains one displayed row; this test is about chords, not // soft-wrap traversal. - try t.start(31, 120, &.{ "-n", "3" }); + // A row more than its panes take: the notice row under them. + try t.start(32, 120, &.{ "-n", "3" }); try t.wait(8000, "f.txt"); try t.stable(700, 20000); // open f.txt: click a body spot, type the name, look it @@ -608,9 +611,12 @@ fn find(gpa: std.mem.Allocator, exe: [:0]const u8) !void { try t.start(41, 120, &.{"here.txt"}); try t.wait(8000, "here.txt"); try t.stable(700, 20000); - // SPC f is a group (Find, New, Save, Recent, Grep): the indicator waits + // SPC f is a group (Find, New, Save, Recent, Grep): its level rolled in + // the tag once SPC's delay is up (a frame on the clock, which a quiet + // screen does not wait for) try t.key("space"); try t.key("f"); + try t.wait(5000, "↓ unroll"); try t.stable(400, 5000); try t.snap("group"); // the second f opens the query pane: every file listed, line 1 `Find ` @@ -738,6 +744,8 @@ fn fsearch(gpa: std.mem.Allocator, exe: [:0]const u8) !void { fn grep(gpa: std.mem.Allocator, exe: [:0]const u8) !void { var t = try Tty.init(gpa, exe, "grep"); defer t.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + try t.config("Jumps new-pane"); try t.dir("sub"); try t.file("a.txt", "hello TARGET one\nnothing here\nlast TARGET line"); try t.file("sub/b.txt", "deep\nTARGET inside sub"); @@ -810,6 +818,8 @@ fn grep(gpa: std.mem.Allocator, exe: [:0]const u8) !void { fn stepgrain(gpa: std.mem.Allocator, exe: [:0]const u8) !void { var t = try Tty.init(gpa, exe, "stepgrain"); defer t.deinit(); + // About the step grain of +Search result rows: `Jumps new-pane` (SPEC §6.6). + try t.config("Jumps new-pane"); try t.dir("sub"); try t.file("a.txt", "hello ZQMARK one\nsee also sub/b.txt for ZQMARK two"); try t.file("sub/b.txt", "ZQMARK inside sub"); @@ -862,6 +872,8 @@ fn stepgrain(gpa: std.mem.Allocator, exe: [:0]const u8) !void { fn look_center(gpa: std.mem.Allocator, exe: [:0]const u8) !void { var t = try Tty.init(gpa, exe, "look-center"); defer t.deinit(); + // About a Look at a file already open re-centring that pane: `Jumps new-pane` (SPEC §6.6). + try t.config("Jumps new-pane"); try t.lines("big.txt", 200, ""); try t.start(31, 150, &.{ "-n", "3" }); try t.wait(8000, "big.txt"); @@ -953,6 +965,8 @@ fn look_file_1col(gpa: std.mem.Allocator, exe: [:0]const u8) !void { fn lookloaded(gpa: std.mem.Allocator, exe: [:0]const u8) !void { var t = try Tty.init(gpa, exe, "lookloaded"); defer t.deinit(); + // About a Look at a file gone from disk focusing the pane that holds it: `Jumps new-pane` (SPEC §6.6). + try t.config("Jumps new-pane"); try t.lines("big.txt", 60, ""); try t.start(31, 100, &.{ "-n", "3" }); try t.wait(8000, "big.txt"); @@ -1118,6 +1132,8 @@ fn lookpanes(gpa: std.mem.Allocator, exe: [:0]const u8) !void { fn lookrange(gpa: std.mem.Allocator, exe: [:0]const u8) !void { var t = try Tty.init(gpa, exe, "lookrange"); defer t.deinit(); + // About r.txt opening below look.txt: `Jumps new-pane` (SPEC §6.6). + try t.config("Jumps new-pane"); try t.file("r.txt", "aaaa\nbbbb\ncccc dccc\ndddd\neeee\nffff\ngg NEEDLE gg\nhhhh NEEDLE\niiii"); try t.file("look.txt", "r.txt:3-5\nr.txt:7:4-9\nr.txt:3:2-5:3\nr.txt:8:6-99:9"); // Builtins announce themselves by default, and an announcement is a band at @@ -1195,6 +1211,8 @@ fn lookrange(gpa: std.mem.Allocator, exe: [:0]const u8) !void { fn jumps(gpa: std.mem.Allocator, exe: [:0]const u8) !void { var t = try Tty.init(gpa, exe, "jumps"); defer t.deinit(); + // About the +Jumps list as text walked with SPC j n/p and Enter: `Jumps new-pane` (SPEC §6.6). + try t.config("Jumps new-pane"); try t.lines("big.txt", 200, ""); try t.start(31, 150, &.{"big.txt"}); try t.wait(8000, "big.txt"); @@ -1325,6 +1343,8 @@ fn jumps(gpa: std.mem.Allocator, exe: [:0]const u8) !void { fn cmdword(gpa: std.mem.Allocator, exe: [:0]const u8) !void { var t = try Tty.init(gpa, exe, "cmdword"); defer t.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + try t.config("Jumps new-pane"); try t.file("cmds.txt", "@`echo ZZ''E` @`echo ZZ''L` Look p.txt @`Look .`"); try t.file("p.txt", "just text"); try t.file("zzmark.txt", "x"); @@ -1588,13 +1608,16 @@ fn lsp_client_edit(gpa: std.mem.Allocator, exe: [:0]const u8) !void { try t.wait(8000, "mod lib;"); try t.stable(700, 15000); try t.snap("unformatted"); - // rename through the leader prompt: both call sites change in one step + // rename through the tag's Rename (SPC l r): both call sites change in + // one step try t.press("left", "13", 6); try t.release("left", "13", 6); try t.key("space"); try t.key("l"); try t.key("r"); try t.stable(400, 5000); + // The tag's Rename starts with the name under the caret: C-u clears it. + try t.key("c-u"); try t.send("sum"); try t.key("enter"); try t.wait(10000, "sum(3, 4)"); @@ -1887,6 +1910,8 @@ fn lspdebug(gpa: std.mem.Allocator, exe: [:0]const u8) !void { fn lsprelpath(gpa: std.mem.Allocator, exe: [:0]const u8) !void { var t = try Tty.init(gpa, exe, "lsprelpath"); defer t.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + try t.config("Jumps new-pane"); try t.dir("sub"); try t.dir("sub/inner"); try t.file("shade.zig", "pub const Shade = enum {\n verdigris,\n cinnabar,\n};\n"); @@ -1959,6 +1984,8 @@ fn lsp_rename(gpa: std.mem.Allocator, exe: [:0]const u8) !void { try t.key("l"); try t.key("r"); try t.stable(400, 5000); + // The tag's Rename starts with the name under the caret: C-u clears it. + try t.key("c-u"); try t.send("renamed_helper"); try t.key("enter"); try t.wait(10000, "renamed_helper(41)"); @@ -1984,6 +2011,8 @@ fn lsp_rename(gpa: std.mem.Allocator, exe: [:0]const u8) !void { fn lsp_rename_files(gpa: std.mem.Allocator, exe: [:0]const u8) !void { var t = try Tty.init(gpa, exe, "lsp-rename-files"); defer t.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + try t.config("Jumps new-pane"); try t.file("lib.rs", "// main.rs\npub fn add(a: i32, b: i32) -> i32 {\n a + b\n}\n"); try t.file("main.rs", "mod lib;\n\nfn main() {\n let x = add(1, 2);\n let y = add(3, 4);\n let _ = x + y;\n}\n"); try t.start(25, 100, &.{"lib.rs"}); @@ -2141,6 +2170,8 @@ fn dirpane(gpa: std.mem.Allocator, exe: [:0]const u8) !void { fn scrolloff(gpa: std.mem.Allocator, exe: [:0]const u8) !void { var t = try Tty.init(gpa, exe, "scrolloff"); defer t.deinit(); + // About today's 9-row file pane its clicks are measured in: `Jumps new-pane` (SPEC §6.6). + try t.config("Jumps new-pane"); try t.lines("g.txt", 40, ""); try t.start(16, 210, &.{ "-n", "1" }); try t.wait(8000, "g.txt"); @@ -2412,6 +2443,10 @@ fn tagcmd(gpa: std.mem.Allocator, exe: [:0]const u8) !void { fn tagnav(gpa: std.mem.Allocator, exe: [:0]const u8) !void { var t = try Tty.init(gpa, exe, "tagnav"); defer t.deinit(); + // Its workspace-tag steps Exec `Themes` (B five times from `$`) and type + // on into the pane it opens: today's Themes list pane, `Jumps new-pane` + // (SPEC §6.6; under walk SPC t t's picker takes those keys). + try t.config("Jumps new-pane"); try t.file("w.txt", "alpha\nbeta\ngamma"); try t.start(31, 100, &.{"w.txt"}); try t.wait(8000, "Newcol Joincol"); |
