vt: don't ignore VS-15 (text presentation)

When we encounter either VS-15 or VS-16, set the grapheme width to 1
or 2 explicitly.
This commit is contained in:
Daniel Eklöf 2024-06-24 20:21:46 +02:00
parent 519e9b8b5e
commit 94583703e1
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 6 additions and 3 deletions

View file

@ -99,12 +99,14 @@
([#1744][1744]). ([#1744][1744]).
* Regression: alpha changes through OSC-11 sequences not taking effect * Regression: alpha changes through OSC-11 sequences not taking effect
until window is resized. until window is resized.
* VS15 being ignored ([#1742][1742]).
[1694]: https://codeberg.org/dnkl/foot/issues/1694 [1694]: https://codeberg.org/dnkl/foot/issues/1694
[1717]: https://codeberg.org/dnkl/foot/issues/1717 [1717]: https://codeberg.org/dnkl/foot/issues/1717
[1718]: https://codeberg.org/dnkl/foot/issues/1718 [1718]: https://codeberg.org/dnkl/foot/issues/1718
[1734]: https://codeberg.org/dnkl/foot/issues/1734 [1734]: https://codeberg.org/dnkl/foot/issues/1734
[1744]: https://codeberg.org/dnkl/foot/issues/1744 [1744]: https://codeberg.org/dnkl/foot/issues/1744
[1742]: https://codeberg.org/dnkl/foot/issues/1742
### Security ### Security

7
vt.c
View file

@ -852,9 +852,11 @@ action_utf8_print(struct terminal *term, char32_t wc)
break; break;
case GRAPHEME_WIDTH_DOUBLE: case GRAPHEME_WIDTH_DOUBLE:
new_cc->width = min(grapheme_width + width, 2);
#if defined(FOOT_GRAPHEME_CLUSTERING) #if defined(FOOT_GRAPHEME_CLUSTERING)
if (unlikely(grapheme_clustering && if (unlikely(grapheme_clustering &&
wc == 0xfe0f && (wc == 0xfe0e || wc == 0xfe0f) &&
new_cc->count == 2)) new_cc->count == 2))
{ {
/* Only emojis should be affected by VS16 */ /* Only emojis should be affected by VS16 */
@ -862,11 +864,10 @@ action_utf8_print(struct terminal *term, char32_t wc)
utf8proc_get_property(new_cc->chars[0]); utf8proc_get_property(new_cc->chars[0]);
if (props->boundclass == UTF8PROC_BOUNDCLASS_EXTENDED_PICTOGRAPHIC) if (props->boundclass == UTF8PROC_BOUNDCLASS_EXTENDED_PICTOGRAPHIC)
width = 2; new_cc->width = wc - 0xfe0d; /* 1 for VS-15, 2 for VS-16 */
} }
#endif #endif
new_cc->width = min(grapheme_width + width, 2);
break; break;
case GRAPHEME_WIDTH_WCSWIDTH: case GRAPHEME_WIDTH_WCSWIDTH: