on master help sign in
change characters of unknown width to 0 width
commit5570a2efb7614112626307e790dc6c7355829c8f authorCorey O'Connor <coreyoconnor@gmail.com> dateFri 5 Jul 2013, 18:34 (13 years ago) parentc5d9a90
1 file changed+4−4
src/Graphics/Text/Width.hs+4−4
src/Graphics/Text/Width.hs+4−4
@@ -20,15 +20,15 @@ wcswidth = sum . map wcwidth
2020-- is not true for all terminals then a per-terminal replacement character width needs to be
2121-- implemented.
2222
23−-- | Returns the display width of a character. Assumes all characters with unknown widths are 1 width
23+-- | Returns the display width of a character. Assumes all characters with unknown widths are 0 width
2424safe_wcwidth :: Char -> Int
2525safe_wcwidth c = case wcwidth c of
26− i | i < 0 -> 1
26+ i | i < 0 -> 0
2727 | otherwise -> i
2828
29−-- | Returns the display width of a string. Assumes all characters with unknown widths are 1 width
29+-- | Returns the display width of a string. Assumes all characters with unknown widths are 0 width
3030safe_wcswidth :: String -> Int
3131safe_wcswidth str = case wcswidth str of
32− i | i < 0 -> 1
32+ i | i < 0 -> 0
3333 | otherwise -> i
3434