summaryrefslogtreecommitdiff
path: root/test/session.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-03 17:09:53 -0300
committerGabriel Schneider <[email protected]>2026-11-03 17:17:31 -0300
commit5cc02232d522d5cd5a453caedd1e592ca20471ea (patch)
tree034d370ad6eed53abb27f2c7ff607f8e656b17c8 /test/session.zig
parent37408da299e21b8807ccd10545482a709bac88c7 (diff)
downloadpardes-5cc02232d522d5cd5a453caedd1e592ca20471ea.tar.gz
pardes-5cc02232d522d5cd5a453caedd1e592ca20471ea.zip
test: eleven more of src/pardes.zig's tests through the 9P tree alone (test/behaviour/columns_and_tags, modes, tags, panes): a click past a column tag's text typing after it, a newline there a space and a long tag scrolled to its caret, Enter and Tab in a tag running the word under the cursor, Esc alternating two panes of a kind, Esc out of a column or the workspace tag, Shift-Esc out of every mode, a name typed into the tag's path pending past Esc, an unsaved file's tag its name alone, a question ended in the log when its pane closes, focus on a closed pane to the one taking its place; Session's cursor (/screen's); each checked to fail against a break (flatten keeping newlines, the header drawn unscrolled, Enter in a header a Look, Esc in normal mode not running Last, Esc in a header not leaving it, Shift-Esc leaving insert on, the first Esc on a drafted name dropping it, a dirty tag marked ' *', del_side left out of noteRetire's answer, removeColumn's focus to any pane)
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'test/session.zig')
-rw-r--r--test/session.zig10
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} {