Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam
2026-05-25 09:15:07 +01:00
4 changed files with 125 additions and 70 deletions

View File

@@ -702,7 +702,7 @@ screen_redraw_draw_pane_status(struct screen_redraw_ctx *ctx)
/* Left not visible. */
l = ctx->ox - xoff;
x = 0;
width = size - i;
width = size - l;
} else {
/* Right not visible. */
l = 0;
@@ -710,7 +710,8 @@ screen_redraw_draw_pane_status(struct screen_redraw_ctx *ctx)
width = size - x;
}
r = screen_redraw_get_visible_ranges(wp, x, yoff, width, NULL);
r = tty_check_overlay_range(tty, x, yoff, width);
r = screen_redraw_get_visible_ranges(wp, x, yoff, width, r);
if (ctx->statustop)
yoff += ctx->statuslines;
for (i = 0; i < r->used; i++) {
@@ -1273,15 +1274,42 @@ screen_redraw_draw_pane(struct screen_redraw_ctx *ctx, struct window_pane *wp)
struct screen *s = wp->screen;
struct colour_palette *palette = &wp->palette;
struct grid_cell defaults;
u_int i, j, woy, wx, wy, py, width;
u_int j, k, woy, wx, wy, py, width;
struct visible_ranges *r;
struct visible_range *ri;
/*
* There are 3 coordinate spaces:
*
* window: (0 to w->sx-1, 0 to w->sy-1)
* tty: (0 to tty->sx-1, 0 to tty->sy-1)
* pane: (0 to wp->sx-1, 0 to wp->sy-1)
*
* Transformations:
* window <-> tty (x-axis):
* window_x = tty_x + ctx->ox
* tty_x = window_x - ctx->ox
*
* window <-> tty (y-axis):
* woy = (ctx->statustop) ? ctx->statuslines : 0
* window_y = tty_y + ctx->oy - woy
* tty_y = woy + window_y - ctx->oy
*
* window <-> pane (x-axis):
* window_x = pane_x + wp->xoff
* pane_x = window_x - wp->xoff
*
* window <-> pane (y-axis):
* window_y = pane_y + wp->yoff
* pane_y = window_y - wp->yoff
*/
if (wp->base.mode & MODE_SYNC)
screen_write_stop_sync(wp);
log_debug("%s: %s @%u %%%u", __func__, c->name, w->id, wp->id);
/* Check if pane completely not visible. */
if (wp->xoff + (int)wp->sx <= ctx->ox ||
wp->xoff >= (int)ctx->ox + (int)ctx->sx)
return;
@@ -1303,37 +1331,36 @@ screen_redraw_draw_pane(struct screen_redraw_ctx *ctx, struct window_pane *wp)
if (wp->xoff >= (int)ctx->ox &&
wp->xoff + (int)wp->sx <= (int)ctx->ox + (int)ctx->sx) {
/* All visible. */
i = 0;
wx = (u_int)(wp->xoff - (int)ctx->ox);
width = wp->sx;
} else if (wp->xoff < (int)ctx->ox &&
wp->xoff + (int)wp->sx > (int)ctx->ox + (int)ctx->sx) {
/* Both left and right not visible. */
i = ctx->ox;
wx = 0;
width = ctx->sx;
} else if (wp->xoff < (int)ctx->ox) {
/* Left not visible. */
i = (u_int)((int)ctx->ox - wp->xoff);
wx = 0;
width = wp->sx - i;
width = wp->sx - ((u_int)((int)ctx->ox - wp->xoff));
} else {
/* Right not visible. */
i = 0;
wx = (u_int)(wp->xoff - (int)ctx->ox);
width = ctx->sx - wx;
}
log_debug("%s: %s %%%u line %u,%u at %u,%u, width %u",
__func__, c->name, wp->id, i, j, wx, wy, width);
/* Get visible ranges of line before we draw it. */
r = screen_redraw_get_visible_ranges(wp, wx, wy, width, NULL);
r = tty_check_overlay_range(tty, wx, wy, width);
r = screen_redraw_get_visible_ranges(wp, wx, wy, width, r);
tty_default_colours(&defaults, wp);
for (i = 0; i < r->used; i++) {
ri = &r->ranges[i];
for (k = 0; k < r->used; k++) {
ri = &r->ranges[k];
if (ri->nx == 0)
continue;
tty_draw_line(tty, s, ri->px - wp->xoff, j, ri->nx,
log_debug("%s: %s %%%u range pane (%u,%u) width %u, tty (%u,%u) width %u",
__func__, c->name, wp->id,
ri->px + (int)ctx->ox - wp->xoff, j, ri->nx,
ri->px, py, ri->nx);
tty_draw_line(tty, s, ri->px + (int)ctx->ox - wp->xoff, j, ri->nx,
ri->px, py, &defaults, palette);
}
}
@@ -1494,13 +1521,13 @@ screen_redraw_draw_scrollbar(struct screen_redraw_ctx *ctx,
}
for (j = jmin; j < jmax; j++) {
wy = sb_y + j; /* window y coordinate */
py = sb_tty_y + j;/* tty y coordinate */
wy = sb_y + j; /* window y coordinate */
py = sb_tty_y + j; /* tty y coordinate */
r = tty_check_overlay_range(tty, sb_x, wy, imax);
r = screen_redraw_get_visible_ranges(wp, sb_x, wy, imax, r);
for (i = imin; i < imax; i++) {
px = sb_x + ox + i; /* tty x coordinate */
wx = sb_x + i; /* window x coordinate */
wx = sb_x + i; /* window x coordinate */
if (wx < xoff - (int)sb_w - (int)sb_pad ||
px >= sx || px < 0 ||
wy < yoff - 1 ||