//! docs/typ/reference.typ, Other files . const std = @import("std"); const Session = @import("session").Session; test "other-files: kbdin types at the pane with the keyboard and mousein clicks, each done before its write is answered" { var s = try Session.initFile(std.testing.allocator, "x\n"); defer s.deinit(); const body = try std.fmt.allocPrint(s.arena.allocator(), "/pane/{d}/body", .{try s.focused()}); try s.keys("ihello \x1b"); try s.expect(body, "hello x\n"); // Plan 9's Khome rune, then text before it. try s.keys("A!\x1b\u{F00D}i>\x1b"); try s.expect(body, ">hello x!\n"); // A left click on the second l, then text there. try s.click(">hello", 4, 1); try s.keys("i#\x1b"); try s.expect(body, ">hel#lo x!\n"); // Refused, in words, as rio and devmouse refuse. try std.testing.expectEqual(@as(u16, 22), try s.refused("/mousein", "m 1 2\n")); try std.testing.expectEqual(@as(u16, 22), try s.refused("/mousein", "x 1 2 0\n")); try std.testing.expectEqual(@as(u16, 22), try s.refused("/kbdin", "\xff")); try std.testing.expectError(error.Refused, s.read("/kbdin")); } test "other-files: kbdin's Kalt rune is Alt on the key after it alone, and an Alt key types nothing" { var s = try Session.initFile(std.testing.allocator, "x\n"); defer s.deinit(); try s.keys("i\u{F015}zy\x1b"); try s.expect(s.at("/pane/{d}/body", .{try s.focused()}), "yx\n"); }