summaryrefslogtreecommitdiff
path: root/test/behaviour/modes.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/behaviour/modes.zig')
-rw-r--r--test/behaviour/modes.zig18
1 files changed, 13 insertions, 5 deletions
diff --git a/test/behaviour/modes.zig b/test/behaviour/modes.zig
index e615920d..0f7c9d26 100644
--- a/test/behaviour/modes.zig
+++ b/test/behaviour/modes.zig
@@ -17,6 +17,8 @@ test "modes: Esc in normal mode alternates between two panes of the same kind" {
const at = dir[0..try tmp.dir.realPath(std.testing.io, &dir)];
var s = try Session.initFile(std.testing.allocator, "a\n");
defer s.deinit();
+ // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6).
+ try s.write("/ctl", "Jumps new-pane\n");
const a = try s.focused();
try s.write("/look", s.at("{s}/b.txt\n", .{at}));
const b = try s.focused();
@@ -118,11 +120,13 @@ fn threePanes(s: *Session) ![3]u32 {
return .{ a, b, c };
}
-/// The panes whose tag (`name Save`) is drawn in `lit`, the outline's colour.
+/// The panes whose tag (`name `: the pane with the keyboard shows window
+/// mode's head after its name, the others their own words) is drawn in
+/// `lit`, the outline's colour.
fn outlined(s: *Session, lit: []const u8, names: []const []const u8) ![]const u8 {
var found: []const u8 = "";
for (names) |name| {
- const x, const y = try s.where(s.at("{s} Save", .{name}));
+ const x, const y = try s.where(s.at("{s} ", .{name}));
if (std.mem.eql(u8, lit, try s.bg(x, y))) found = s.at("{s}{s}", .{ found, name });
}
return found;
@@ -131,10 +135,12 @@ fn outlined(s: *Session, lit: []const u8, names: []const []const u8) ![]const u8
test "modes: Ctrl-w outlines a pane, h j k l move the outline, and Enter, Esc, : or a pane's letter gives it the keyboard" {
var s = try Session.initFile(std.testing.allocator, "left\n");
defer s.deinit();
+ // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6).
+ try s.write("/ctl", "Jumps new-pane\n");
const a, const b, const c = try threePanes(&s);
const names = &[_][]const u8{ "/a.txt", "/b.txt", "/c.txt" };
try s.keys("\x17");
- const x, const y = try s.where("/a.txt Save");
+ const x, const y = try s.where("/a.txt ");
const lit = try s.bg(x, y);
try std.testing.expectEqualStrings("/a.txt", try outlined(&s, lit, names));
// Each pane's box shows its letter: the left column's is a.
@@ -174,6 +180,8 @@ fn listed(s: *Session, n: u32) !bool {
test "modes: in window mode d deletes the outlined pane, asking k or j between two, c collapses it, and the mode stays on" {
var s = try Session.initFile(std.testing.allocator, "top\n");
defer s.deinit();
+ // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6).
+ try s.write("/ctl", "Jumps new-pane\n");
const top = try s.focused();
try s.write(s.at("/pane/{d}/exec", .{top}), "New\n");
const mid = try s.focused();
@@ -198,7 +206,7 @@ test "modes: in window mode d deletes the outlined pane, asking k or j between t
try std.testing.expectEqualStrings("/mid", try outlined(&s, lit, names));
try s.keys("c");
try std.testing.expect(std.mem.indexOf(u8, try s.read(s.at("/pane/{d}/ctl", .{mid})), " collapsed ") == null);
- try expectEqual(row_low, (try s.where("/low Save"))[1]);
+ try expectEqual(row_low, (try s.where("/low "))[1]);
// d between two panes asks, as SPC d does; Esc takes it back, the
// outline where it was.
try s.keys("d");
@@ -210,7 +218,7 @@ test "modes: in window mode d deletes the outlined pane, asking k or j between t
try s.keys("dj");
try std.testing.expect(!try listed(&s, mid));
try expectEqual(row_top, (try s.where("/test.txt Save"))[1]);
- try expectEqual(row_mid, (try s.where("/low Save"))[1]);
+ try expectEqual(row_mid, (try s.where("/low "))[1]);
try std.testing.expectEqualStrings("/low", try outlined(&s, lit, &.{ "/test.txt", "/low" }));
// With one neighbour nothing is asked: d closes it, the outline on the
// pane that grew.