diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-20 15:52:03 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-20 16:13:22 -0300 |
| commit | 8953e01fba330404ded0e5b87bf4f4bb1cfddbb8 (patch) | |
| tree | 4cb5554e13cf18e340587347e75e52630fd62058 /test/tty.zig | |
| parent | df0fe00d35c1a01a852d7518ef884ec7aab7ace6 (diff) | |
| download | pardes-8953e01fba330404ded0e5b87bf4f4bb1cfddbb8.tar.gz pardes-8953e01fba330404ded0e5b87bf4f4bb1cfddbb8.zip | |
tui: a frame with no caret hides the terminal's cursor: the frontend called showCursor for a frame with a caret and nothing for one without (dev/tui/tui.zig, the frame's end), vaxis keeps cursor_vis, so the block cursor stayed visible where the last caret was (hscroll: on the first text column of a view wheeled sideways past the caret; a +Search or a pane whose caret is off screen; a terminal pane's spawn); now win.hideCursor; the tty harness records a hidden cursor as `cursor=hidden` (where a hidden cursor was left is no one's: test/e2e_harness.zig `cursor` says `shown`, test/tty.zig's snap and stable key read it): with the harness alone no golden moved (0 of 145), with the fix ten moved, each only in snap headers from cursor=X,Y to cursor=hidden (checked line by line, golden_diff.py): collapse 2, follow 1, hscroll 1, images 2, jumps 1, lspcomplete 1, shrinktag 2, ttytaken 1, wheeldrift 4, wrap 1, re-recorded; a user saw it: a stale block cursor on the text in every frame with no caret
Co-Authored-By: Claude Opus <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'test/tty.zig')
| -rw-r--r-- | test/tty.zig | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/test/tty.zig b/test/tty.zig index 47fca229..f26328ca 100644 --- a/test/tty.zig +++ b/test/tty.zig @@ -584,7 +584,7 @@ fn stateKey(h: *eh.Harness) ![]u8 { styles.update("\x00"); } } - return std.fmt.allocPrint(h.gpa, "{d},{d},{x}\n{s}", .{ c.x, c.y, styles.final(), text }); + return std.fmt.allocPrint(h.gpa, "{d},{d},{},{x}\n{s}", .{ c.x, c.y, c.shown, styles.final(), text }); } /// A mouse column: either a screen column, or `@Word` / `@Word#2` - the column @@ -814,7 +814,8 @@ fn snap9pText(arena: std.mem.Allocator, h: *eh.Harness, label: []const u8, prev: return out.items; } -/// `== snap <label> grid=CxR cursor=X,Y` then either the whole screen as +/// `== snap <label> grid=CxR cursor=X,Y` (`cursor=hidden` when the app +/// hides it: where a hidden cursor was left is no one's) then either the whole screen as /// `|<row text>` (first capture of a case, or after a resize) or just the /// rows that changed as `|<n>: <row text>`. An indexed row is a patch against /// the previous capture; an unindexed one is a frame. @@ -827,9 +828,8 @@ fn snapText(arena: std.mem.Allocator, h: *eh.Harness, label: []const u8, prev: * for (rows) |*r| r.* = try arena.dupe(u8, std.mem.trimEnd(u8, it.next() orelse "", " ")); var out: std.ArrayList(u8) = .empty; - try out.appendSlice(arena, try std.fmt.allocPrint(arena, "== snap {s} grid={d}x{d} cursor={d},{d}\n", .{ - label, h.cols, h.rows, c.x, c.y, - })); + try out.appendSlice(arena, try std.fmt.allocPrint(arena, "== snap {s} grid={d}x{d} cursor=", .{ label, h.cols, h.rows })); + try out.appendSlice(arena, if (c.shown) try std.fmt.allocPrint(arena, "{d},{d}\n", .{ c.x, c.y }) else "hidden\n"); if (prev.snap.len == rows.len and prev.snap_cols == h.cols) { for (rows, prev.snap, 0..) |now, was, i| { if (std.mem.eql(u8, now, was)) continue; |
