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

@@ -1151,8 +1151,28 @@ window_pane_scrollbar_auto_hide(struct window_pane *wp)
"pane-scrollbars-auto-hide"));
}
static void
int
window_pane_scrollbar_overlay_visible(struct window_pane *wp)
{
int sb;
sb = options_get_number(wp->window->options, "pane-scrollbars");
return (window_pane_scrollbar_overlay(wp, sb) &&
window_pane_scrollbar_visible(wp, sb));
}
void
window_pane_scrollbar_redraw(struct window_pane *wp)
{
if (window_pane_scrollbar_overlay_visible(wp)) {
wp->flags |= PANE_REDRAW;
return;
}
wp->flags |= PANE_REDRAWSCROLLBAR;
}
static void
window_pane_scrollbar_redraw_visibility(struct window_pane *wp)
{
redraw_invalidate_scene(wp->window);
wp->flags |= PANE_REDRAW;
@@ -2066,7 +2086,7 @@ window_pane_scrollbar_show(struct window_pane *wp, int start_timer)
if (start_timer)
window_pane_scrollbar_start_timer(wp);
if (changed)
window_pane_scrollbar_redraw(wp);
window_pane_scrollbar_redraw_visibility(wp);
}
void
@@ -2078,7 +2098,7 @@ window_pane_scrollbar_hide(struct window_pane *wp)
if (!wp->sb_auto_visible)
return;
wp->sb_auto_visible = 0;
window_pane_scrollbar_redraw(wp);
window_pane_scrollbar_redraw_visibility(wp);
}
int