Fix cursor and redraw overlap with auto-hide scrollbars

Auto-hide scrollbars are drawn as overlays inside the pane rather than in
reserved columns. Avoid optimized pane scrolling/redraw paths writing through
a visible overlay scrollbar, and suppress the terminal cursor when it would be
placed in the visible overlay scrollbar column.

This prevents transient wrong-colour cells and cursor blocks appearing over
the scrollbar, especially when scrolling small floating panes.  This fixed
the green block issue.
This commit is contained in:
Michael Grant
2026-06-20 09:09:27 +02:00
parent 738083c4a4
commit fe1c3db1e5
5 changed files with 61 additions and 11 deletions

View File

@@ -1882,7 +1882,7 @@ server_client_reset_state(struct client *c)
struct screen *s = NULL;
struct options *oo = c->session->options;
int mode = 0, cursor, flags, pane_mode = 0;
u_int cx = 0, cy = 0, ox, oy, sx, sy, n;
u_int cx = 0, cy = 0, ox, oy, sx, sy, n, sb_w;
struct visible_ranges *r;
if (c->flags & (CLIENT_CONTROL|CLIENT_SUSPENDED))
@@ -1942,6 +1942,21 @@ server_client_reset_state(struct client *c)
if (!window_position_is_visible(r, cx))
cursor = 0;
if (window_pane_scrollbar_overlay_visible(wp)) {
sb_w = wp->scrollbar_style.width;
if (sb_w > wp->sx)
sb_w = wp->sx;
if (sb_w != 0 &&
options_get_number(w->options,
"pane-scrollbars-position") ==
PANE_SCROLLBARS_LEFT) {
if (s->cx < sb_w)
cursor = 0;
} else if (sb_w != 0 &&
s->cx >= wp->sx - sb_w)
cursor = 0;
}
if (status_at_line(c) == 0)
cy += status_line_size(c);
}