summaryrefslogtreecommitdiff
path: root/tests/model.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/model.c')
-rw-r--r--tests/model.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/tests/model.c b/tests/model.c
index d212acb..6c9f288 100644
--- a/tests/model.c
+++ b/tests/model.c
@@ -31,7 +31,7 @@
#define STR_KEEP 1024
struct cell {
- uint32_t cp[GRAPHEME_MAX_LEN];
+ uint32_t cp[TERM_GRAPHEME_MAX_LEN];
uint8_t n, width;
uint16_t attrs;
term_color fg, bg;
@@ -99,7 +99,7 @@ struct model {
bool tabs[MAX_TABS];
struct keyboard keyboard[2];
/* The last printed glyph, for REP and cluster joins. */
- uint32_t last[GRAPHEME_MAX_LEN];
+ uint32_t last[TERM_GRAPHEME_MAX_LEN];
int last_n;
int prompt; /* screen row of the last OSC 133;A, or -1 */
unsigned flags;
@@ -159,7 +159,7 @@ static bool pristine(const struct model *m)
static bool is_ri(uint32_t cp)
{
- return cp - 0x1F1E6u <= 0x19u && grapheme_regional_indicator(cp);
+ return cp - 0x1F1E6u <= 0x19u && term_grapheme_regional_indicator(cp);
}
/* ---- replies ---- */
@@ -418,13 +418,13 @@ static void fill_gap(struct row *r, int x)
static uint16_t presentation(const uint32_t *cps, int n)
{
- bool pictographic = unicode_extended_pictographic(cps[0]);
+ bool pictographic = term_unicode_extended_pictographic(cps[0]);
bool emoji = false;
for (int i = 1; i < n; i++) {
if (cps[i] == 0xFE0F) return TERM_ATTR_EMOJI;
if (cps[i] == 0xFE0E) return TERM_ATTR_TEXT;
- if (cps[i] == 0x20E3 || grapheme_regional_indicator(cps[i]) ||
- (pictographic && (cps[i] == 0x200D || grapheme_emoji_modifier(cps[i]) ||
+ if (cps[i] == 0x20E3 || term_grapheme_regional_indicator(cps[i]) ||
+ (pictographic && (cps[i] == 0x200D || term_grapheme_emoji_modifier(cps[i]) ||
(cps[i] >= 0xE0020 && cps[i] <= 0xE007F))))
emoji = true;
}
@@ -444,7 +444,7 @@ static void put_glyph(struct model *m, const uint32_t *cps, int n, uint16_t attr
{
if (n > 1)
attrs = (uint16_t)((attrs & ~(TERM_ATTR_EMOJI | TERM_ATTR_TEXT)) | presentation(cps, n));
- int width = unicode_width(cps[0]) == 2 ? 2 : 1;
+ int width = term_unicode_width(cps[0]) == 2 ? 2 : 1;
if (attrs & TERM_ATTR_EMOJI) width = 2;
if (attrs & TERM_ATTR_TEXT) width = 1;
if (m->pending) wrap_to_next_row(m);
@@ -496,14 +496,14 @@ static void put_glyph(struct model *m, const uint32_t *cps, int n, uint16_t attr
static bool joins(uint32_t cp, int width)
{
if (cp < 0x300) return false;
- return width == 0 || grapheme_emoji_modifier(cp) ||
- (width == 1 && unicode_spacing_mark(cp));
+ return width == 0 || term_grapheme_emoji_modifier(cp) ||
+ (width == 1 && term_unicode_spacing_mark(cp));
}
static bool cluster_joins(const uint32_t *cps, int n, uint32_t cp, int width)
{
if (joins(cp, width)) return true;
- if (cps[n - 1] == 0x200D) return unicode_extended_pictographic(cp);
+ if (cps[n - 1] == 0x200D) return term_unicode_extended_pictographic(cp);
return n == 1 && is_ri(cp) && is_ri(cps[0]);
}
@@ -528,10 +528,10 @@ static bool extend_cluster(struct model *m, uint32_t cp, int width)
return joins(cp, width);
if (!cluster_joins(prev->cp, prev->n, cp, width))
return false;
- if (prev->n >= GRAPHEME_MAX_LEN)
+ if (prev->n >= TERM_GRAPHEME_MAX_LEN)
return true;
struct cell old = *prev;
- uint32_t cps[GRAPHEME_MAX_LEN];
+ uint32_t cps[TERM_GRAPHEME_MAX_LEN];
memcpy(cps, old.cp, (size_t)old.n * sizeof(*cps));
cps[old.n] = cp;
int n = old.n + 1;
@@ -591,7 +591,7 @@ static void print_cp(struct model *m, uint32_t cp)
emit(m, cp);
return;
}
- int width = unicode_width(cp);
+ int width = term_unicode_width(cp);
if (!extend_cluster(m, cp, width))
emit(m, cp);
}