From d5b5baf119a514731a2e73f36a50ac94b33f9a0e Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Tue, 13 Oct 2026 20:48:59 +0300 Subject: Optimize DECALN screen alignment fill with row memory replication --- src/core.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core.c b/src/core.c index 01218cc..f9d547d 100644 --- a/src/core.c +++ b/src/core.c @@ -475,10 +475,16 @@ void term_sc_deccara(struct term *t, const struct csi *csi) void term_sc_decaln(struct term *t) { struct cell fill = { .c = 'E', .fg = TERM_COLOR_FG, .bg = TERM_COLOR_BG }; + struct cell *row0 = NULL; for (int y = 0; y < t->rows; y++) { int p = phys_row(t, y); struct cell *row = row_cells(t, p); - for (int x = 0; x < t->cols; x++) row[x] = fill; + if (row0) { + memcpy(row, row0, (size_t)t->cols * sizeof(struct cell)); + } else { + for (int x = 0; x < t->cols; x++) row[x] = fill; + row0 = row; + } struct srow *srow = &t->scr.slot[p]; srow->len = (uint16_t)t->cols; srow->flags = RF_TAIL_PADDED; -- cgit v1.2.3