mirror of
https://github.com/ilyakooo0/vty.git
synced 2024-11-29 16:54:42 +03:00
buildUnicodeWidthTable: cleanup
This commit is contained in:
parent
f475aaaaa5
commit
1faafd71d9
@ -6,7 +6,6 @@ where
|
||||
|
||||
import Control.Monad (forM)
|
||||
import Data.Char (generalCategory, GeneralCategory(..))
|
||||
import Data.Maybe (catMaybes)
|
||||
import System.Console.ANSI (getCursorPosition)
|
||||
import Text.Printf (printf)
|
||||
|
||||
@ -64,10 +63,8 @@ unicodeTableUpperBound = '\x2FFFF'
|
||||
-- system performance.
|
||||
buildUnicodeWidthTable :: IO UnicodeWidthTable
|
||||
buildUnicodeWidthTable = do
|
||||
pairs <- fmap catMaybes $ forM ['\0'..unicodeTableUpperBound] $ \i ->
|
||||
if shouldConsider i
|
||||
then (Just . (i,)) <$> charWidth i
|
||||
else return Nothing
|
||||
pairs <- forM (filter shouldConsider ['\0'..unicodeTableUpperBound]) $ \i ->
|
||||
(i,) <$> charWidth i
|
||||
|
||||
return UnicodeWidthTable { unicodeWidthTableRanges = reverse $ mkRanges pairs
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user