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

@@ -5284,7 +5284,10 @@ window_copy_redraw_lines(struct window_mode_entry *wme, u_int py, u_int ny)
return;
}
screen_write_start_pane(&ctx, wp, NULL);
if (window_pane_scrollbar_overlay_visible(wp))
screen_write_start(&ctx, &data->screen);
else
screen_write_start_pane(&ctx, wp, NULL);
for (i = py; i < py + ny; i++)
window_copy_write_line(wme, &ctx, i);
screen_write_cursormove(&ctx,
@@ -5292,7 +5295,7 @@ window_copy_redraw_lines(struct window_mode_entry *wme, u_int py, u_int ny)
0);
screen_write_stop(&ctx);
wp->flags |= PANE_REDRAWSCROLLBAR;
window_pane_scrollbar_redraw(wp);
}
static void
@@ -6580,7 +6583,10 @@ window_copy_scroll_up(struct window_mode_entry *wme, u_int ny)
return;
}
screen_write_start_pane(&ctx, wp, NULL);
if (window_pane_scrollbar_overlay_visible(wp))
screen_write_start(&ctx, &data->screen);
else
screen_write_start_pane(&ctx, wp, NULL);
screen_write_cursormove(&ctx, 0, 0, 0);
screen_write_deleteline(&ctx, ny, 8);
window_copy_write_lines(wme, &ctx, screen_size_y(s) - ny, ny);
@@ -6595,7 +6601,7 @@ window_copy_scroll_up(struct window_mode_entry *wme, u_int ny)
window_copy_cursor_offset(wme, data->cx, screen_size_x(s)), data->cy,
0);
screen_write_stop(&ctx);
wp->flags |= PANE_REDRAWSCROLLBAR;
window_pane_scrollbar_redraw(wp);
}
static void
@@ -6641,7 +6647,10 @@ window_copy_scroll_down(struct window_mode_entry *wme, u_int ny)
return;
}
screen_write_start_pane(&ctx, wp, NULL);
if (window_pane_scrollbar_overlay_visible(wp))
screen_write_start(&ctx, &data->screen);
else
screen_write_start_pane(&ctx, wp, NULL);
screen_write_cursormove(&ctx, 0, 0, 0);
screen_write_insertline(&ctx, ny, 8);
window_copy_write_lines(wme, &ctx, 0, ny);
@@ -6652,7 +6661,7 @@ window_copy_scroll_down(struct window_mode_entry *wme, u_int ny)
screen_write_cursormove(&ctx, window_copy_cursor_offset(wme, data->cx,
screen_size_x(s)), data->cy, 0);
screen_write_stop(&ctx);
wp->flags |= PANE_REDRAWSCROLLBAR;
window_pane_scrollbar_redraw(wp);
}
static void