@@ -26,6 +26,10 @@ charWidth c = do
26 Just (_, col) <- getCursorPosition
26 Just (_, col) <- getCursorPosition
27 return col
27 return col
29+-- | Convert a sequence of character/width pairs into a list of
30+-- run-length encoded ranges. This function assumes the pairs come
31+-- sorted by character ordinal value. It does not require that the
32+-- character range is fully covered by the sequence.
29mkRanges :: [(Char, Int)] -> [WidthTableRange]
33mkRanges :: [(Char, Int)] -> [WidthTableRange]
30mkRanges pairs =
34mkRanges pairs =
31 let convertedPairs = convert <$> pairs
35 let convertedPairs = convert <$> pairs