aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-05-01 09:49:11 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-05-01 09:49:11 +0000
commitb2c4115f3e5b36ff04b2f7ff1af4d7bce787a16f (patch)
tree1c44914488682c35599fa393d59a776edf7a87d4
parentutil.h: new header file defining commonly used macros (diff)
grid: add per-cell combining characters
The data is *not* added to the cell struct, since that one is too performance critical. Instead, the data is added as a separate array in the row struct. This allows our performance critical code paths that e.g. clear cells to perform as before.
-rw-r--r--grid.c6
-rw-r--r--terminal.h6
2 files changed, 11 insertions, 1 deletions
diff --git a/grid.c b/grid.c
index 51d76191..9da36934 100644
--- a/grid.c
+++ b/grid.c
@@ -34,10 +34,13 @@ grid_row_alloc(int cols, bool initialize)
if (initialize) {
row->cells = calloc(cols, sizeof(row->cells[0]));
+ row->comb_chars = calloc(cols, sizeof(row->comb_chars[0]));
for (size_t c = 0; c < cols; c++)
row->cells[c].attrs.clean = 1;
- } else
+ } else {
row->cells = malloc(cols * sizeof(row->cells[0]));
+ row->comb_chars = malloc(cols * sizeof(row->comb_chars[0]));
+ }
return row;
}
@@ -48,6 +51,7 @@ grid_row_free(struct row *row)
if (row == NULL)
return;
+ free(row->comb_chars);
free(row->cells);
free(row);
}
diff --git a/terminal.h b/terminal.h
index 7152bc23..e653e9be 100644
--- a/terminal.h
+++ b/terminal.h
@@ -77,10 +77,16 @@ struct damage {
int lines;
};
+struct combining_chars {
+ uint8_t count;
+ wchar_t chars[5]; /* TODO: do we need this many? */
+};
+
struct row {
struct cell *cells;
bool dirty;
bool linebreak;
+ struct combining_chars *comb_chars;
};
struct sixel {