summaryrefslogtreecommitdiff
path: root/test/behaviour
diff options
context:
space:
mode:
Diffstat (limited to 'test/behaviour')
-rw-r--r--test/behaviour/keys.zig16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/behaviour/keys.zig b/test/behaviour/keys.zig
index 118681cd..e1f550e3 100644
--- a/test/behaviour/keys.zig
+++ b/test/behaviour/keys.zig
@@ -387,3 +387,19 @@ test "keys: a PDF in normal mode keeps : (its tag and back), SPC (a leader, canc
try std.testing.expect(try s.cursor() == null);
try std.testing.expectEqual(n, try s.focused());
}
+
+test "keys: zz and zc put the cursor's line in the middle row of an odd view, as many lines above it as below (helix align_view)" {
+ var lines: [30][4]u8 = undefined;
+ 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();
+ for ([_][]const u8{ "15jzz", "ztzc" }) |keys| {
+ try s.keys(keys);
+ // 80x24 gives the pane 21 rows: 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]);
+ try std.testing.expectError(error.NotOnScreen, s.where("l04"));
+ try std.testing.expectError(error.NotOnScreen, s.where("l26"));
+ }
+}