From 46be03d88e3b60a4de6280a2dfd2610d088bab01 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Tue, 26 May 2026 13:02:07 +0100 Subject: [PATCH] Clamp range with to size of window (visible ranges cannot be outside window). --- screen-redraw.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/screen-redraw.c b/screen-redraw.c index c9f49b3d..2836260d 100644 --- a/screen-redraw.c +++ b/screen-redraw.c @@ -1155,6 +1155,10 @@ screen_redraw_get_visible_ranges(struct window_pane *base_wp, u_int px, return (&sr); } + w = base_wp->window; + if (px + width > w->sx) + width = w->sx - px; + if (r == NULL) { /* Start with the entire width of the range. */ server_client_ensure_ranges(&base_wp->r, 1); @@ -1164,7 +1168,6 @@ screen_redraw_get_visible_ranges(struct window_pane *base_wp, u_int px, r->used = 1; } - w = base_wp->window; sb = options_get_number(w->options, "pane-scrollbars"); sb_pos = options_get_number(w->options, "pane-scrollbars-position");