mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-21 05:33:45 -04:00
term: rename COMB_CHARS_LO,HI -> CELL_COMB_CHARS_LO,HI
This commit is contained in:
parent
4cf7195695
commit
5c99e8013b
4 changed files with 14 additions and 13 deletions
6
render.c
6
render.c
|
|
@ -408,10 +408,10 @@ render_cell(struct terminal *term, pixman_image_t *pix,
|
||||||
if (cell->wc != 0) {
|
if (cell->wc != 0) {
|
||||||
wchar_t base = cell->wc;
|
wchar_t base = cell->wc;
|
||||||
|
|
||||||
if (base >= COMB_CHARS_LO &&
|
if (base >= CELL_COMB_CHARS_LO &&
|
||||||
base < (COMB_CHARS_LO + term->composed_count))
|
base < (CELL_COMB_CHARS_LO + term->composed_count))
|
||||||
{
|
{
|
||||||
composed = &term->composed[base - COMB_CHARS_LO];
|
composed = &term->composed[base - CELL_COMB_CHARS_LO];
|
||||||
base = composed->base;
|
base = composed->base;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -321,8 +321,9 @@ extract_one(struct terminal *term, struct row *row, struct cell *cell,
|
||||||
|
|
||||||
assert(ctx->idx + 1 <= ctx->size);
|
assert(ctx->idx + 1 <= ctx->size);
|
||||||
|
|
||||||
if (cell->wc >= COMB_CHARS_LO && cell->wc < (COMB_CHARS_LO + term->composed_count)) {
|
if (cell->wc >= CELL_COMB_CHARS_LO &&
|
||||||
const struct composed *composed = &term->composed[cell->wc - COMB_CHARS_LO];
|
cell->wc < (CELL_COMB_CHARS_LO + term->composed_count)) {
|
||||||
|
const struct composed *composed = &term->composed[cell->wc - CELL_COMB_CHARS_LO];
|
||||||
|
|
||||||
ctx->buf[ctx->idx++] = composed->base;
|
ctx->buf[ctx->idx++] = composed->base;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,8 @@ struct attributes {
|
||||||
};
|
};
|
||||||
static_assert(sizeof(struct attributes) == 8, "bad size");
|
static_assert(sizeof(struct attributes) == 8, "bad size");
|
||||||
|
|
||||||
|
#define CELL_COMB_CHARS_LO 0x40000000ul
|
||||||
|
#define CELL_COMB_CHARS_HI 0x400ffffful
|
||||||
struct cell {
|
struct cell {
|
||||||
wchar_t wc;
|
wchar_t wc;
|
||||||
struct attributes attrs;
|
struct attributes attrs;
|
||||||
|
|
@ -216,8 +218,6 @@ struct terminal {
|
||||||
struct grid alt;
|
struct grid alt;
|
||||||
struct grid *grid;
|
struct grid *grid;
|
||||||
|
|
||||||
#define COMB_CHARS_LO 0x40000000ul
|
|
||||||
#define COMB_CHARS_HI 0x400ffffful
|
|
||||||
size_t composed_count;
|
size_t composed_count;
|
||||||
struct composed *composed;
|
struct composed *composed;
|
||||||
|
|
||||||
|
|
|
||||||
12
vt.c
12
vt.c
|
|
@ -550,9 +550,9 @@ action_utf8_print(struct terminal *term, wchar_t wc)
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct composed *composed =
|
const struct composed *composed =
|
||||||
(base >= COMB_CHARS_LO &&
|
(base >= CELL_COMB_CHARS_LO &&
|
||||||
base < (COMB_CHARS_LO + term->composed_count))
|
base < (CELL_COMB_CHARS_LO + term->composed_count))
|
||||||
? &term->composed[base - COMB_CHARS_LO]
|
? &term->composed[base - CELL_COMB_CHARS_LO]
|
||||||
: NULL;
|
: NULL;
|
||||||
|
|
||||||
if (composed != NULL)
|
if (composed != NULL)
|
||||||
|
|
@ -635,7 +635,7 @@ action_utf8_print(struct terminal *term, wchar_t wc)
|
||||||
if (cc->combining[wanted_count - 1] != wc)
|
if (cc->combining[wanted_count - 1] != wc)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
term_print(term, COMB_CHARS_LO + i, base_width);
|
term_print(term, CELL_COMB_CHARS_LO + i, base_width);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -648,12 +648,12 @@ action_utf8_print(struct terminal *term, wchar_t wc)
|
||||||
new_cc.combining[i] = composed->combining[i];
|
new_cc.combining[i] = composed->combining[i];
|
||||||
new_cc.combining[wanted_count - 1] = wc;
|
new_cc.combining[wanted_count - 1] = wc;
|
||||||
|
|
||||||
if (term->composed_count < COMB_CHARS_HI) {
|
if (term->composed_count < CELL_COMB_CHARS_HI) {
|
||||||
term->composed_count++;
|
term->composed_count++;
|
||||||
term->composed = realloc(term->composed, term->composed_count * sizeof(term->composed[0]));
|
term->composed = realloc(term->composed, term->composed_count * sizeof(term->composed[0]));
|
||||||
term->composed[term->composed_count - 1] = new_cc;
|
term->composed[term->composed_count - 1] = new_cc;
|
||||||
|
|
||||||
term_print(term, COMB_CHARS_LO + term->composed_count - 1, base_width);
|
term_print(term, CELL_COMB_CHARS_LO + term->composed_count - 1, base_width);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
/* We reached our maximum number of allowed composed
|
/* We reached our maximum number of allowed composed
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue