diff options
Diffstat (limited to 'test/session.zig')
| -rw-r--r-- | test/session.zig | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/session.zig b/test/session.zig index c4ed0db2..f67f3b25 100644 --- a/test/session.zig +++ b/test/session.zig @@ -210,6 +210,16 @@ pub const Session = struct { const col = cols.next() orelse return error.NoColumn; return std.fmt.parseInt(u32, col[0..std.mem.indexOfScalar(u8, col, ':').?], 10); } + + /// Where /screen draws the cursor, column and row; null when it draws none. + pub fn cursor(s: *Session) !?struct { usize, usize } { + const json = try std.json.parseFromSliceLeaky(std.json.Value, s.arena.allocator(), try s.read("/screen"), .{}); + const c = switch (json.object.get("cursor").?) { + .object => |o| o, + else => return null, + }; + return .{ @intCast(c.get("x").?.integer), @intCast(c.get("y").?.integer) }; + } }; fn refusal(path: []const u8, r: Reply) error{Refused} { |
