From 17e583d377adf443aebede0fc510dc174579b0a5 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Fri, 19 Jun 2026 09:48:15 +0100 Subject: [PATCH] Merge offset and size clamp functions. --- screen-redraw.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/screen-redraw.c b/screen-redraw.c index 6a49b9a4..5e4517e9 100644 --- a/screen-redraw.c +++ b/screen-redraw.c @@ -260,12 +260,15 @@ redraw_flags_string(int flags) return (s); } -/* Expand size to cover any part of the client outside the window. */ +/* Get window offset and expand size to cover any part outside the window. */ static void -redraw_expand_size(struct client *c, u_int *sx, u_int *sy) +redraw_get_window_offset(struct client *c, u_int *ox, u_int *oy, u_int *sx, + u_int *sy) { u_int tty_sx, tty_sy; + tty_window_offset(&c->tty, ox, oy, sx, sy); + tty_sx = c->tty.sx; tty_sy = c->tty.sy - status_line_size(c); if (*sx < tty_sx) @@ -285,8 +288,7 @@ redraw_set_context(struct client *c, struct redraw_build_ctx *bctx) memset(bctx, 0, sizeof *bctx); bctx->c = c; bctx->w = w; - tty_window_offset(&c->tty, &bctx->ox, &bctx->oy, &bctx->sx, &bctx->sy); - redraw_expand_size(c, &bctx->sx, &bctx->sy); + redraw_get_window_offset(c, &bctx->ox, &bctx->oy, &bctx->sx, &bctx->sy); bctx->sb = options_get_number(oo, "pane-scrollbars"); bctx->sbp = options_get_number(oo, "pane-scrollbars-position"); @@ -1005,8 +1007,7 @@ redraw_get_scene(struct client *c) const char *reason = NULL; u_int ox, oy, sx, sy; - tty_window_offset(&c->tty, &ox, &oy, &sx, &sy); - redraw_expand_size(c, &sx, &sy); + redraw_get_window_offset(c, &ox, &oy, &sx, &sy); if (scene == NULL) reason = "missing"; else if (scene->w != w)