diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2024-02-16 06:11:07 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2024-02-16 06:13:32 +0000 |
| commit | 0c94bf43f221f81e3aa184d88c31d6dbea1e23f9 (patch) | |
| tree | bb11aa337986c6c8a3f0afb3cb3f2b407a1af4e4 | |
| parent | vt: VS16 - variation selector 16 (emoji representation) should only affect emojis (diff) | |
vt: ignore VS16 (U+FE0F) when grapheme clustering is disabled
This fixes:
a) a compilation error with -Dgrapheme-clustering=disabled
b) ensures U+FE0F does *not* allocate a two cells when grapheme
clustering has been disabled (either compile time, in config, or
run-time).
| -rw-r--r-- | vt.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -850,7 +850,11 @@ action_utf8_print(struct terminal *term, char32_t wc) break; case GRAPHEME_WIDTH_DOUBLE: - if (unlikely(wc == 0xfe0f && new_cc->count == 2)) { +#if defined(FOOT_GRAPHEME_CLUSTERING) + if (unlikely(grapheme_clustering && + wc == 0xfe0f && + new_cc->count == 2)) + { /* Only emojis should be affected by VS16 */ const utf8proc_property_t *props = utf8proc_get_property(new_cc->chars[0]); @@ -858,6 +862,8 @@ action_utf8_print(struct terminal *term, char32_t wc) if (props->boundclass == UTF8PROC_BOUNDCLASS_EXTENDED_PICTOGRAPHIC) width = 2; } +#endif + new_cc->width = min(grapheme_width + width, 2); break; |
