Merge branch 'master' into floating_panes

This commit is contained in:
Nicholas Marriott
2026-05-30 12:48:11 +01:00
4 changed files with 27 additions and 12 deletions

View File

@@ -1119,11 +1119,11 @@ screen_redraw_is_visible(struct visible_ranges *r, u_int px)
/*
* Construct ranges array for the line at starting at px,py of width cells of
* base_wp that are unobsructed.
* base_wp that are unobsructed. All ranges are in window coordinates.
*/
struct visible_ranges *
screen_redraw_get_visible_ranges(struct window_pane *base_wp, u_int px,
u_int py, u_int width, struct visible_ranges *r)
screen_redraw_get_visible_ranges(struct window_pane *base_wp, int px,
int py, u_int width, struct visible_ranges *r)
{
struct window_pane *wp;
struct window *w;
@@ -1133,11 +1133,25 @@ screen_redraw_get_visible_ranges(struct window_pane *base_wp, u_int px,
u_int lb, rb, tb, bb;
u_int i, s;
if (px + width <= 0 || py < 0) {
if (r == NULL) {
if (sr.ranges == NULL)
sr.ranges = xcalloc(1, sizeof *sr.ranges);
sr.size = 1;
sr.used = 0;
return (&sr);
}
r->used = 0;
return (r);
}
if (px < 0) {
px = 0;
width += px;
}
if (base_wp == NULL) {
if (r != NULL)
return (r);
/* Return static range as last resort. */
if (sr.ranges == NULL)
sr.ranges = xcalloc(1, sizeof *sr.ranges);
sr.ranges[0].px = px;
@@ -1174,10 +1188,10 @@ screen_redraw_get_visible_ranges(struct window_pane *base_wp, u_int px,
bb = wp->yoff + wp->sy;
if (!found_self ||
!window_pane_visible(wp) ||
py < tb ||
py > bb)
(u_int)py < tb ||
(u_int)py > bb)
continue;
if (~wp->flags & PANE_FLOATING && py == bb)
if (~wp->flags & PANE_FLOATING && (u_int)py == bb)
continue;
sb_w = wp->scrollbar_style.width + wp->scrollbar_style.pad;

View File

@@ -1132,7 +1132,7 @@ screen_write_redraw_line(struct screen_write_ctx *ctx, struct tty_ctx *ttyctx,
struct screen *s = ctx->s;
struct grid_cell gc, ngc;
u_int sx = screen_size_x(s), cx, i, n;
u_int xoff = wp->xoff, yoff = wp->yoff;
int xoff = wp->xoff, yoff = wp->yoff;
struct visible_ranges *r;
struct visible_range *ri;

2
tmux.h
View File

@@ -3368,7 +3368,7 @@ void screen_redraw_screen(struct client *);
void screen_redraw_pane(struct client *, struct window_pane *, int);
int screen_redraw_is_visible(struct visible_ranges *, u_int);
struct visible_ranges *screen_redraw_get_visible_ranges(struct window_pane *,
u_int, u_int, u_int, struct visible_ranges *);
int, int, u_int, struct visible_ranges *);
/* screen.c */
void screen_init(struct screen *, u_int, u_int, u_int);

5
tty.c
View File

@@ -2029,10 +2029,11 @@ tty_cmd_cell(struct tty *tty, const struct tty_ctx *ctx)
px = ctx->xoff + ctx->ocx - ctx->wox;
py = ctx->yoff + ctx->ocy - ctx->woy;
if (!tty_is_visible(tty, ctx, ctx->ocx, ctx->ocy, 1, 1) ||
(gcp->data.width == 1 && !tty_check_overlay(tty, px, py)))
if (!tty_is_visible(tty, ctx, ctx->ocx, ctx->ocy, 1, 1))
return;
if (gcp->data.width == 1 && !tty_check_overlay(tty, px, py))
return;
if (gcp->data.width > 1) { /* could be partially obscured */
r = tty_check_overlay_range(tty, px, py, gcp->data.width);
for (i = 0; i < r->used; i++)