Check the overlay visible ranges when we have a tty and check the panes visible ranges when we have a wp. Overlays checked at tty level (for most part) and pane overlays checked at screen level where possible to keep separation of abstraction relatively clean.

This commit is contained in:
Michael Grant
2026-02-11 09:30:48 +00:00
parent b46a96d454
commit 476c6e89ad
3 changed files with 6 additions and 13 deletions

View File

@@ -1239,10 +1239,11 @@ screen_redraw_get_visible_ranges(struct window_pane *base_wp, u_int px,
then split range into 2 ranges. */ then split range into 2 ranges. */
else if (lb > ri->px && else if (lb > ri->px &&
rb < ri->px + ri->nx) { rb < ri->px + ri->nx) {
server_client_ensure_ranges(r, r->size + 1); server_client_ensure_ranges(r, r->used + 1);
for (s=r->used; s>i; s--) for (s=r->used; s>i; s--)
memcpy(&r->ranges[s-1], &r->ranges[s], memcpy(&r->ranges[s], &r->ranges[s-1],
sizeof (struct visible_range)); sizeof (struct visible_range));
ri = &r->ranges[i];
r->ranges[i+1].px = rb + 1; r->ranges[i+1].px = rb + 1;
r->ranges[i+1].nx = ri->px + ri->nx - (rb + 1); r->ranges[i+1].nx = ri->px + ri->nx - (rb + 1);
/* ri->px was copied, unchanged. */ /* ri->px was copied, unchanged. */
@@ -1338,8 +1339,7 @@ screen_redraw_draw_pane(struct screen_redraw_ctx *ctx, struct window_pane *wp)
__func__, c->name, wp->id, i, j, wx, wy, width); __func__, c->name, wp->id, i, j, wx, wy, width);
/* Get visible ranges of line before we draw it. */ /* Get visible ranges of line before we draw it. */
r = tty_check_overlay_range(tty, px, py, width); r = screen_redraw_get_visible_ranges(wp, wx, wy, width, NULL);
r = screen_redraw_get_visible_ranges(wp, wx, wy, width, r);
tty_default_colours(&defaults, wp); tty_default_colours(&defaults, wp);

View File

@@ -122,7 +122,7 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int px, u_int py, u_int nx,
char buf[1000]; char buf[1000];
size_t len; size_t len;
enum tty_draw_line_state current_state, next_state; enum tty_draw_line_state current_state, next_state;
/* xxx maybe check overlay here? */
/* /*
* py is the line in the screen to draw. px is the start x and nx is * py is the line in the screen to draw. px is the start x and nx is
* the width to draw. atx,aty is the line on the terminal to draw it. * the width to draw. atx,aty is the line on the terminal to draw it.

9
tty.c
View File

@@ -1209,7 +1209,6 @@ tty_clear_pane_line(struct tty *tty, const struct tty_ctx *ctx, u_int py,
u_int px, u_int nx, u_int bg) u_int px, u_int nx, u_int bg)
{ {
struct client *c = tty->client; struct client *c = tty->client;
struct window_pane *wp = ctx->arg;
struct visible_ranges *r; struct visible_ranges *r;
struct visible_range *ri; struct visible_range *ri;
u_int i, l, x, rx, ry; u_int i, l, x, rx, ry;
@@ -1218,7 +1217,6 @@ tty_clear_pane_line(struct tty *tty, const struct tty_ctx *ctx, u_int py,
if (tty_clamp_line(tty, ctx, px, py, nx, &l, &x, &rx, &ry)) { if (tty_clamp_line(tty, ctx, px, py, nx, &l, &x, &rx, &ry)) {
r = tty_check_overlay_range(tty, x, ry, rx); r = tty_check_overlay_range(tty, x, ry, rx);
r = screen_redraw_get_visible_ranges(wp, x, ry, rx, r);
for (i=0; i < r->used; i++) { for (i=0; i < r->used; i++) {
ri = &r->ranges[i]; ri = &r->ranges[i];
if (ri->nx == 0) if (ri->nx == 0)
@@ -1382,7 +1380,6 @@ tty_clear_area(struct tty *tty, const struct tty_ctx *ctx, u_int py,
/* Couldn't use an escape sequence, loop over the lines. */ /* Couldn't use an escape sequence, loop over the lines. */
for (yy = py; yy < py + ny; yy++) { for (yy = py; yy < py + ny; yy++) {
r = tty_check_overlay_range(tty, px, yy - oy, nx); r = tty_check_overlay_range(tty, px, yy - oy, nx);
r = screen_redraw_get_visible_ranges(wp, px, yy - oy, nx, r);
for (i=0; i < r->used; i++) { for (i=0; i < r->used; i++) {
ri = &r->ranges[i]; ri = &r->ranges[i];
if (ri->nx == 0) continue; if (ri->nx == 0) continue;
@@ -1419,8 +1416,6 @@ tty_draw_pane(struct tty *tty, const struct tty_ctx *ctx, u_int py)
if (!ctx->bigger) { if (!ctx->bigger) {
if (wp) { if (wp) {
r = tty_check_overlay_range(tty, 0, ctx->yoff + py, nx); r = tty_check_overlay_range(tty, 0, ctx->yoff + py, nx);
r = screen_redraw_get_visible_ranges(wp, 0, ctx->yoff +
py, nx, r);
for (i=0; i < r->used; i++) { for (i=0; i < r->used; i++) {
ri = &r->ranges[i]; ri = &r->ranges[i];
if (ri->nx == 0) continue; if (ri->nx == 0) continue;
@@ -1437,7 +1432,6 @@ tty_draw_pane(struct tty *tty, const struct tty_ctx *ctx, u_int py)
if (tty_clamp_line(tty, ctx, 0, py, nx, &px, &x, &rx, &ry)) { if (tty_clamp_line(tty, ctx, 0, py, nx, &px, &x, &rx, &ry)) {
if (wp) { if (wp) {
r = tty_check_overlay_range(tty, i, py, rx); r = tty_check_overlay_range(tty, i, py, rx);
r = screen_redraw_get_visible_ranges(wp, i, py, rx, r);
for (i=0; i < r->used; i++) { for (i=0; i < r->used; i++) {
ri = &r->ranges[i]; ri = &r->ranges[i];
if (ri->nx == 0) if (ri->nx == 0)
@@ -1916,8 +1910,7 @@ tty_cmd_scrollup(struct tty *tty, const struct tty_ctx *ctx)
!tty_term_has(tty->term, TTYC_CSR) || !tty_term_has(tty->term, TTYC_CSR) ||
ctx->sx == 1 || ctx->sx == 1 ||
ctx->sy == 1 || ctx->sy == 1 ||
c->overlay_check != NULL || c->overlay_check != NULL) {
tty_is_obscured(ctx)) {
tty_redraw_region(tty, ctx); tty_redraw_region(tty, ctx);
return; return;
} }