From 8953e01fba330404ded0e5b87bf4f4bb1cfddbb8 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 20 Nov 2026 15:52:03 -0300 Subject: 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 Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- dev/tui/tui.zig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'dev/tui/tui.zig') diff --git a/dev/tui/tui.zig b/dev/tui/tui.zig index 638f1400..30b334b3 100644 --- a/dev/tui/tui.zig +++ b/dev/tui/tui.zig @@ -1785,10 +1785,12 @@ const Shell = struct { vx.freeImage(sc.tty.writer(), removed.value.id); if (stale_len < stale.len) break; } + // A frame with no caret hides the terminal's cursor: shown, it + // would stay where the last caret was. if (shown.cursor) |cur| { win.showCursor(cur.x, cur.y); win.setCursorShape(if (cur.bar) .beam else .default); - } + } else win.hideCursor(); const tz_render = tracy.zone(@src(), "vx.render"); const before = sc.tty.tty_writer.pos + sc.tty.writer().end; vx.render(sc.tty.writer()) catch {}; -- cgit v1.3