From 6aa2f299011747b20af9bde4dc129cb572244bfc Mon Sep 17 00:00:00 2001 From: Aaron Gyes Date: Tue, 19 Feb 2019 04:21:29 -0800 Subject: [PATCH] Don't increase the width for variation selector 15. See discussion in #5668 and #5583 --- src/fallback.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/fallback.cpp b/src/fallback.cpp index 3f2912551..485c93b51 100644 --- a/src/fallback.cpp +++ b/src/fallback.cpp @@ -282,8 +282,10 @@ int fish_wcswidth(const wchar_t *str, size_t n) { return wcswidth(str, n); } int fish_wcwidth(wchar_t wc) { // Check for VS16 which selects emoji presentation. This "promotes" a character like U+2764 // (width 1) to an emoji (probably width 2). So treat it as width 1 so the sums work. See #2652. - const int variation_selector_16 = 0xFE0F; + // VS15 selects text presentation. + const wchar_t variation_selector_16 = L'\uFE0F', variation_selector_15 = L'\uFE0E'; if (wc == variation_selector_16) return 1; + else if (wc == variation_selector_15) return 0; int width = widechar_wcwidth(wc); switch (width) {