fix wcwidth wrongly returning 0 for most of planes 4 and up
authorRich Felker <dalias@aerifal.cx>
Thu, 2 Jan 2020 01:02:51 +0000 (20:02 -0500)
committerRich Felker <dalias@aerifal.cx>
Thu, 2 Jan 2020 01:02:51 +0000 (20:02 -0500)
commit 1b0ce9af6d2aa7b92edaf3e9c631cb635bae22bd introduced this bug
back in 2012 and it was never noticed, presumably since the affected
planes are essentially unused in Unicode.

src/ctype/wcwidth.c

index 49c40eea8cabfc6f1a0a30aafda9625e85b82611..36256a538551bca3b2c2e7d751f5f05dced856f9 100644 (file)
@@ -23,7 +23,7 @@ int wcwidth(wchar_t wc)
                return -1;
        if (wc-0x20000U < 0x20000)
                return 2;
-       if (wc == 0xe0001 || wc-0xe0020U < 0x5f || wc-0xe0100 < 0xef)
+       if (wc == 0xe0001 || wc-0xe0020U < 0x5f || wc-0xe0100U < 0xef)
                return 0;
        return 1;
 }