diff options
Diffstat (limited to 'test/behaviour/keys.zig')
| -rw-r--r-- | test/behaviour/keys.zig | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/test/behaviour/keys.zig b/test/behaviour/keys.zig index c5dccb1e..241468ac 100644 --- a/test/behaviour/keys.zig +++ b/test/behaviour/keys.zig @@ -14,7 +14,7 @@ test "keys: a prompt's entry and cancellation leave the tag, the body and its cu const n = try s.focused(); const tag = s.at("/pane/{d}/tag", .{n}); const dot = s.at("/pane/{d}/dot", .{n}); - try s.replace(tag, " keep"); + try s.replace(tag, "keep"); for ([_]struct { keys: []const u8, shown: []const u8 }{ .{ .keys = "s", .shown = " s zq" }, .{ .keys = "|", .shown = " | zq" }, @@ -34,14 +34,15 @@ test "keys: a prompt's entry and cancellation leave the tag, the body and its cu try s.keys("\x1b"); try std.testing.expectError(error.NotOnScreen, s.where(case.shown)); try std.testing.expect(std.mem.endsWith(u8, try s.read(s.at("/pane/{d}/ctl", .{n})), " mode:normal ")); - try std.testing.expectEqualStrings("/test.txt keep", try s.read(tag)); + try std.testing.expectEqualStrings("/test.txt Del keep", try s.read(tag)); try std.testing.expectEqual(.{ 6, 6 }, try s.range(dot)); try s.expect(s.at("/pane/{d}/body", .{n}), "one\ntwo\n"); } - // Save on a scratch asks for a path, starting from its directory. + // Save on a scratch (SPC f s: no word of its tag, UX K'3) asks for a + // path, starting from its directory. const scratch = try s.newPane(); const scratch_tag = try s.read(s.at("/pane/{d}/tag", .{scratch})); - try s.keys("::\tzq"); + try s.keys(" fszq"); _ = try s.where("/zq"); try s.expect(s.at("/pane/{d}/tag", .{scratch}), scratch_tag); try s.keys("\x1b"); @@ -124,7 +125,7 @@ test "keys: a count or a prefix a click or a change of pane cancels leaves nothi .body => try s.click("abcdefghij", 3, 1), .tag => { // A clicked tag is in normal mode: `:` goes back. - try s.click("/test.txt Save", "/test.txt ".len + 3, 1); + try s.click("/test.txt Del", "/test.txt ".len + 2, 1); try s.keys(":"); }, .focus, .last => { @@ -273,7 +274,8 @@ test "keys: Save's prompt on a scratch starts from the scratch's directory, one // New from the file's pane: a scratch in its directory. try s.write(s.at("/pane/{d}/exec", .{n}), "New\n"); try std.testing.expect(try s.focused() != n); - try s.keys("::\tzq"); + // SPC f s: Save is no word of a scratch's tag (UX K'3). + try s.keys(" fszq"); _ = try s.where(c[1]); try s.keys("\x1b"); } @@ -412,11 +414,12 @@ test "keys: zz and zc put the cursor's line in the middle row of an odd view, as for (&lines, 0..) |*l, i| _ = try std.fmt.bufPrint(l, "l{d:0>2}\n", .{i}); var s = try Session.initFile(std.testing.allocator, std.mem.asBytes(&lines)); defer s.deinit(); - s.resize(80, 25); + s.resize(80, 24); for ([_][]const u8{ "15jzz", "ztzc" }) |keys| { try s.keys(keys); - // 80x25 gives the pane 21 rows (the notice row under it): l05 to - // l25, l15 the eleventh + // 80x24 gives the pane 21 rows (the window row and its tag above + // them, the notice row under them; one column, no column row): + // l05 to l25, l15 the eleventh const top = (try s.where("l05"))[1]; try std.testing.expectEqual(top + 10, (try s.where("l15"))[1]); try std.testing.expectEqual(top + 20, (try s.where("l25"))[1]); |
