diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-05-01 10:06:09 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2020-05-01 10:06:09 +0000 |
| commit | 99172e7f8e0a7caa1356a9beebf7d22288e5f7a1 (patch) | |
| tree | 92af8f394e1124952cf69652bdb340376765f730 /grid.c | |
| parent | term: don't enable ptmx FDM callback until Wayland window has been configured (diff) | |
| parent | unicode-combining: completely remove unicode combining characters when feature is disabled (diff) | |
Merge branch 'unicode-combining-for-real'
Diffstat (limited to 'grid.c')
| -rw-r--r-- | grid.c | 26 |
1 files changed, 23 insertions, 3 deletions
@@ -7,8 +7,7 @@ #define LOG_ENABLE_DBG 0 #include "log.h" #include "sixel.h" - -#define max(x, y) ((x) > (y) ? (x) : (y)) +#include "util.h" void grid_swap_row(struct grid *grid, int row_a, int row_b, bool initialize) @@ -35,10 +34,17 @@ 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 + } 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; } @@ -49,6 +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); } @@ -205,6 +214,17 @@ 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 + = &new_row->comb_chars[new_col_idx]; + + 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) { tll_foreach(tracking_points, it) { |
