mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
unicode-combining: completely remove unicode combining characters when feature is disabled
This commit is contained in:
parent
66e5abdda3
commit
3474624c2c
5 changed files with 26 additions and 2 deletions
8
grid.c
8
grid.c
|
|
@ -34,12 +34,16 @@ grid_row_alloc(int cols, bool initialize)
|
|||
|
||||
if (initialize) {
|
||||
row->cells = calloc(cols, sizeof(row->cells[0]));
|
||||
#if FOOT_UNICODE_COMBINING
|
||||
row->comb_chars = calloc(cols, sizeof(row->comb_chars[0]));
|
||||
#endif
|
||||
for (size_t c = 0; c < cols; c++)
|
||||
row->cells[c].attrs.clean = 1;
|
||||
} else {
|
||||
row->cells = malloc(cols * sizeof(row->cells[0]));
|
||||
#if FOOT_UNICODE_COMBINING
|
||||
row->comb_chars = malloc(cols * sizeof(row->comb_chars[0]));
|
||||
#endif
|
||||
}
|
||||
|
||||
return row;
|
||||
|
|
@ -51,7 +55,9 @@ grid_row_free(struct row *row)
|
|||
if (row == NULL)
|
||||
return;
|
||||
|
||||
#if FOOT_UNICODE_COMBINING
|
||||
free(row->comb_chars);
|
||||
#endif
|
||||
free(row->cells);
|
||||
free(row);
|
||||
}
|
||||
|
|
@ -208,6 +214,7 @@ grid_reflow(struct grid *grid, int new_rows, int new_cols,
|
|||
new_row->cells[new_col_idx] = *old_cell;
|
||||
new_row->cells[new_col_idx].attrs.clean = 1;
|
||||
|
||||
#if FOOT_UNICODE_COMBINING
|
||||
struct combining_chars *old_comb_chars
|
||||
= &old_row->comb_chars[c - empty_count + i];
|
||||
struct combining_chars *new_comb_chars
|
||||
|
|
@ -216,6 +223,7 @@ grid_reflow(struct grid *grid, int new_rows, int new_cols,
|
|||
new_comb_chars->count = old_comb_chars->count;
|
||||
for (size_t j = 0; j < ALEN(new_comb_chars->chars); j++)
|
||||
new_comb_chars->chars[j] = old_comb_chars->chars[j];
|
||||
#endif
|
||||
|
||||
/* Translate tracking point(s) */
|
||||
if (is_tracking_point && i >= empty_count) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue