From 113aaf37fc5c3b278a50b94c568782f32ae03ef4 Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 13 Nov 2025 13:08:44 +0000 Subject: [PATCH] When copying a line from one screen to another, stop only when both source and target are beyond the allocated line length. Fixes problems with trailing spaces on pane-border-format. GitHub issue 4688 from Dmitry Ryabkov. --- screen-write.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/screen-write.c b/screen-write.c index 8e04681a..43afb50d 100644 --- a/screen-write.c +++ b/screen-write.c @@ -583,7 +583,8 @@ screen_write_fast_copy(struct screen_write_ctx *ctx, struct screen *src, if (wp != NULL) screen_write_initctx(ctx, &ttyctx, 0); for (xx = px; xx < px + nx; xx++) { - if (xx >= grid_get_line(gd, yy)->cellsize) + if (xx >= grid_get_line(gd, yy)->cellsize && + s->cx >= grid_get_line(ctx->s->grid, s->cy)->cellsize) break; grid_get_cell(gd, xx, yy, &gc); if (xx + gc.data.width > px + nx)