summaryrefslogtreecommitdiff
path: root/test/behaviour/placement.zig
blob: 350e94f875215158cab0aeb4eca764338647e109 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//! docs/typ/reference.typ, Placement <placement>.
const std = @import("std");
const Session = @import("session").Session;

test "placement: an empty active column takes the new pane whole, a look from another column's text too" {
    var tmp = std.testing.tmpDir(.{});
    defer tmp.cleanup();
    try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "f.txt", .data = "f\n" });
    var dir: [4096]u8 = undefined;
    const at = dir[0..try tmp.dir.realPath(std.testing.io, &dir)];
    var s = try Session.initFile(std.testing.allocator, "x\n");
    defer s.deinit();
    const first = try s.focused();
    // Its tag has the keyboard: it is the active column, and stays so
    // when Esc gives the keyboard back.
    try s.write("/ctl", "Newcol\n");
    try s.keys("\x1b");
    try std.testing.expectEqual(first, try s.focused());
    // A look from the first pane's text still lands in the active column,
    // as acme's makenewwindow puts it in activecol first (util.c:456).
    try s.write(s.at("/pane/{d}/look", .{first}), s.at("{s}/f.txt\n", .{at}));
    const made = try s.focused();
    try std.testing.expectEqualStrings(s.at("{d}:{d} {d}:{d}", .{ try s.column(0), first, try s.column(1), made }), try s.columns());
}