Merge branch 'floating_panes' into floating_panes_staging

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

View File

@@ -1117,11 +1117,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 * 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 * struct visible_ranges *
screen_redraw_get_visible_ranges(struct window_pane *base_wp, u_int px, screen_redraw_get_visible_ranges(struct window_pane *base_wp, int px,
u_int py, u_int width, struct visible_ranges *r) int py, u_int width, struct visible_ranges *r)
{ {
struct window_pane *wp; struct window_pane *wp;
struct window *w; struct window *w;
@@ -1131,11 +1131,25 @@ screen_redraw_get_visible_ranges(struct window_pane *base_wp, u_int px,
u_int lb, rb, tb, bb; u_int lb, rb, tb, bb;
u_int i, s; 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 (base_wp == NULL) {
if (r != NULL) if (r != NULL)
return (r); return (r);
/* Return static range as last resort. */
if (sr.ranges == NULL) if (sr.ranges == NULL)
sr.ranges = xcalloc(1, sizeof *sr.ranges); sr.ranges = xcalloc(1, sizeof *sr.ranges);
sr.ranges[0].px = px; sr.ranges[0].px = px;
@@ -1172,10 +1186,10 @@ screen_redraw_get_visible_ranges(struct window_pane *base_wp, u_int px,
bb = wp->yoff + wp->sy; bb = wp->yoff + wp->sy;
if (!found_self || if (!found_self ||
!window_pane_visible(wp) || !window_pane_visible(wp) ||
py < tb || (u_int)py < tb ||
py > bb) (u_int)py > bb)
continue; continue;
if (~wp->flags & PANE_FLOATING && py == bb) if (~wp->flags & PANE_FLOATING && (u_int)py == bb)
continue; continue;
sb_w = wp->scrollbar_style.width + wp->scrollbar_style.pad; sb_w = wp->scrollbar_style.width + wp->scrollbar_style.pad;

View File

@@ -1129,7 +1129,7 @@ screen_write_redraw_line(struct screen_write_ctx *ctx, struct tty_ctx *ttyctx,
struct screen *s = ctx->s; struct screen *s = ctx->s;
struct grid_cell gc, ngc; struct grid_cell gc, ngc;
u_int sx = screen_size_x(s), cx, i, n; 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_ranges *r;
struct visible_range *ri; struct visible_range *ri;

2
tmux.h
View File

@@ -3359,7 +3359,7 @@ void screen_redraw_screen(struct client *);
void screen_redraw_pane(struct client *, struct window_pane *, int); void screen_redraw_pane(struct client *, struct window_pane *, int);
int screen_redraw_is_visible(struct visible_ranges *, u_int); int screen_redraw_is_visible(struct visible_ranges *, u_int);
struct visible_ranges *screen_redraw_get_visible_ranges(struct window_pane *, 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 */ /* screen.c */
void screen_init(struct screen *, u_int, u_int, u_int); 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; px = ctx->xoff + ctx->ocx - ctx->wox;
py = ctx->yoff + ctx->ocy - ctx->woy; py = ctx->yoff + ctx->ocy - ctx->woy;
if (!tty_is_visible(tty, ctx, ctx->ocx, ctx->ocy, 1, 1) || if (!tty_is_visible(tty, ctx, ctx->ocx, ctx->ocy, 1, 1))
(gcp->data.width == 1 && !tty_check_overlay(tty, px, py)))
return; return;
if (gcp->data.width == 1 && !tty_check_overlay(tty, px, py))
return;
if (gcp->data.width > 1) { /* could be partially obscured */ if (gcp->data.width > 1) { /* could be partially obscured */
r = tty_check_overlay_range(tty, px, py, gcp->data.width); r = tty_check_overlay_range(tty, px, py, gcp->data.width);
for (i = 0; i < r->used; i++) for (i = 0; i < r->used; i++)