Treat Fitzpatrick emoji modifiers as width 0

Fixes #8275
This commit is contained in:
ridiculousfish
2021-09-09 18:06:59 -07:00
parent 40b40a4316
commit 29413665c5
2 changed files with 8 additions and 1 deletions

View File

@@ -260,6 +260,12 @@ int fish_wcwidth(wchar_t wc) {
// or standalone with a 1 width. Since that's literally not expressible with wcwidth(),
// we take the position that the typical way for them to show up is composed.
if (wc >= L'\u1160' && wc <= L'\u11FF') return 0;
// Check for Emoji_Modifier property. Only the Fitzpatrick modifiers have this, in range
// 1F3FB..1F3FF. This is a hack because such an emoji appearing on its own would be drawn as
// width 2, but that's unlikely to be useful. See #8275.
if (wc >= 0x1F3FB && wc <= 0x1F3FF) return 0;
int width = widechar_wcwidth(wc);
switch (width) {