@@ -57,7 +57,7 @@ instance Show TextBlock where
57breakLines :: Int -- ^ Maximum length of lines.
57breakLines :: Int -- ^ Maximum length of lines.
58 -> [String] -- ^ List of lines.
58 -> [String] -- ^ List of lines.
59 -> [String]
59 -> [String]
60−breakLines width [] = []
60+breakLines _ [] = []
61breakLines width (l:ls) =
61breakLines width (l:ls) =
62 if length l > width
62 if length l > width
63 then (take width l):(breakLines width ((drop width l):ls))
63 then (take width l):(breakLines width ((drop width l):ls))
@@ -93,9 +93,9 @@ hPad :: Int -- ^ Desired width.
93 -> String -- ^ String to pad.
93 -> String -- ^ String to pad.
95hPad width line =
95hPad width line =
96− let lineLength = length line
96+ let linelen = length line
97− in if lineLength <= width
97+ in if linelen <= width
98− then line ++ replicate (width - lineLength) ' '
98+ then line ++ replicate (width - linelen) ' '
99 else take width line
99 else take width line
101-- | Concatenates a list of @TextBlock@s into a new @TextBlock@ in
101-- | Concatenates a list of @TextBlock@s into a new @TextBlock@ in
@@ -116,6 +116,7 @@ hcatBlocks ((TextBlock width1 height1 lns1):xs) =
116hsepBlocks :: [TextBlock] -> TextBlock
116hsepBlocks :: [TextBlock] -> TextBlock
117hsepBlocks = hcatBlocks . (intersperse (TextBlock 1 1 [" "]))
117hsepBlocks = hcatBlocks . (intersperse (TextBlock 1 1 [" "]))
119+isWhitespace :: Char -> Bool
119isWhitespace x = x `elem` " \t"
120isWhitespace x = x `elem` " \t"
121-- | Left-aligns the contents of a @TextBlock@ within the block.
122-- | Left-aligns the contents of a @TextBlock@ within the block.