aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-07-14 14:41:57 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-07-14 14:41:57 +0000
commit5c99e8013b3e8fb68e55250be550e856636ccf7b (patch)
treeb4928daca1a7c75ae6bbbfa6d90d049c76aba607
parentselection: recognize empty padding cells in a forced linewrap (diff)
term: rename COMB_CHARS_LO,HI -> CELL_COMB_CHARS_LO,HI
-rw-r--r--render.c6
-rw-r--r--selection.c5
-rw-r--r--terminal.h4
-rw-r--r--vt.c12
4 files changed, 14 insertions, 13 deletions
diff --git a/render.c b/render.c
index 99ca03e3..d2a278ff 100644
--- a/render.c
+++ b/render.c
@@ -408,10 +408,10 @@ render_cell(struct terminal *term, pixman_image_t *pix,
if (cell->wc != 0) {
wchar_t base = cell->wc;
- if (base >= COMB_CHARS_LO &&
- base < (COMB_CHARS_LO + term->composed_count))
+ if (base >= CELL_COMB_CHARS_LO &&
+ 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;
}
diff --git a/selection.c b/selection.c
index cd3780a7..8dc83906 100644
--- a/selection.c
+++ b/selection.c
@@ -321,8 +321,9 @@ extract_one(struct terminal *term, struct row *row, struct cell *cell,
assert(ctx->idx + 1 <= ctx->size);
- if (cell->wc >= COMB_CHARS_LO && cell->wc < (COMB_CHARS_LO + term->composed_count)) {
- const struct composed *composed = &term->composed[cell->wc - COMB_CHARS_LO];
+ if (cell->wc >= CELL_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;
diff --git a/terminal.h b/terminal.h
index 4d1cceff..f32f86dc 100644
--- a/terminal.h
+++ b/terminal.h
@@ -48,6 +48,8 @@ struct attributes {
};
static_assert(sizeof(struct attributes) == 8, "bad size");
+#define CELL_COMB_CHARS_LO 0x40000000ul
+#define CELL_COMB_CHARS_HI 0x400ffffful
struct cell {
wchar_t wc;
struct attributes attrs;
@@ -216,8 +218,6 @@ struct terminal {
struct grid alt;
struct grid *grid;
- #define COMB_CHARS_LO 0x40000000ul
- #define COMB_CHARS_HI 0x400ffffful
size_t composed_count;
struct composed *composed;
diff --git a/vt.c b/vt.c
index 8d9d6cfa..618611c6 100644
--- a/vt.c
+++ b/vt.c
@@ -550,9 +550,9 @@ action_utf8_print(struct terminal *term, wchar_t wc)
}
const struct composed *composed =
- (base >= COMB_CHARS_LO &&
- base < (COMB_CHARS_LO + term->composed_count))
- ? &term->composed[base - COMB_CHARS_LO]
+ (base >= CELL_COMB_CHARS_LO &&
+ base < (CELL_COMB_CHARS_LO + term->composed_count))
+ ? &term->composed[base - CELL_COMB_CHARS_LO]
: NULL;
if (composed != NULL)
@@ -635,7 +635,7 @@ action_utf8_print(struct terminal *term, wchar_t wc)
if (cc->combining[wanted_count - 1] != wc)
continue;
- term_print(term, COMB_CHARS_LO + i, base_width);
+ term_print(term, CELL_COMB_CHARS_LO + i, base_width);
return;
}
@@ -648,12 +648,12 @@ action_utf8_print(struct terminal *term, wchar_t wc)
new_cc.combining[i] = composed->combining[i];
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 = realloc(term->composed, term->composed_count * sizeof(term->composed[0]));
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;
} else {
/* We reached our maximum number of allowed composed