Merge pull request #1790 from mpickering/master
Text.Pandoc.Pretty: Improve performance of realLength
commitdc16f21d981044db8478c9dfb0ee2145370b5b5f
authorJohn MacFarlane <jgm@berkeley.edu>
dateSun 7 Dec 2014, 00:12 (12 years ago)
parentad242139761283
src/Text/Pandoc/Pretty.hs+1−1
@@ -534,4 +534,4 @@ charWidth c =
534534-- | Get real length of string, taking into account combining and double-wide
535535-- characters.
536536realLength :: String -> Int
537−realLength = sum . map charWidth
537+realLength = foldr (\a b -> charWidth a + b) 0