From 360ba86950d5cbd860887ba8f0fe1c46eb198b6e Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Fri, 19 Jun 2026 09:59:30 +0100 Subject: [PATCH] Make how borders are replaced easier to understand. --- screen-redraw.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/screen-redraw.c b/screen-redraw.c index 5e4517e98..23b7b7c80 100644 --- a/screen-redraw.c +++ b/screen-redraw.c @@ -520,13 +520,23 @@ redraw_mark_border_cell(struct redraw_build_ctx *bctx, int wx, int wy, return; bc = redraw_get_build_cell(bctx, x, y); - if (bc->data.type == REDRAW_SPAN_BORDER) { - if (floating && !redraw_data_has_pane(&bc->data, wp)) + /* + * If this is a tiled pane, only empty and border cells may be marked. + * Border cells are merged and empty cells are updated. + * + * Floating panes may mark any existing cell type. All cells are reset + * except borders that already belong to this pane, they need to be + * merged. + */ + if (!floating) { + if (bc->data.type == REDRAW_SPAN_EMPTY) reset = 1; - } else { - if (!floating && bc->data.type != REDRAW_SPAN_EMPTY) + else if (bc->data.type != REDRAW_SPAN_BORDER) return; - reset = 1; + } else { + if (bc->data.type != REDRAW_SPAN_BORDER || + !redraw_data_has_pane(&bc->data, wp)) + reset = 1; } if (reset) { memset(bc, 0, sizeof *bc);