on master help sign in
buildUnicodeWidthTable: add cautionary note about code point space
commit7fdc7151c8d1c727ddee7430bd6069ead2f7d1bd authorJonathan Daugherty <cygnus@foobox.com> dateThu 27 Feb 2020, 16:54 (7 years ago) parent0db1f71
1 file changed+6
src/Graphics/Vty/UnicodeWidthTable/Query.hs+6
src/Graphics/Vty/UnicodeWidthTable/Query.hs+6
@@ -53,6 +53,12 @@ mkRanges pairs =
5353-- system performance.
5454buildUnicodeWidthTable :: IO UnicodeWidthTable
5555buildUnicodeWidthTable = do
56+ -- NB: this only covers some of the possible Unicode range and is
57+ -- sure to become stale eventually. Granted, at the time of this
58+ -- writing, even the latest version of Unicode (13) totals 143,859
59+ -- characters and that only gets us to code point 0x231f3 or so. But
60+ -- it's only a matter of time before the bound in this loop is too
61+ -- low.
5662 pairs <- fmap catMaybes $ forM ['\0'..'\x2FFFF'] $ \i ->
5763 if shouldConsider i
5864 then (Just . (i,)) <$> charWidth i