summaryrefslogtreecommitdiff
path: root/src/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core.c')
-rw-r--r--src/core.c8
1 files changed, 7 insertions, 1 deletions
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;