on master help sign in
Clarify the meaning of "escapes" in some Haddocks (fixes #186)
commit17e25608460a62d54cf8537b8850ef566bea747b authorJonathan Daugherty <cygnus@foobox.com> dateSat 2 May 2020, 15:53 (6 years ago) parentf7eef97
1 file changed+10−8
src/Graphics/Vty/Image.hs+10−8
src/Graphics/Vty/Image.hs+10−8
@@ -117,14 +117,16 @@ horizCat = foldr horizJoin EmptyImage
117117vertCat :: [Image] -> Image
118118vertCat = foldr vertJoin EmptyImage
119119
120−-- | Make an 'Image' from a lazy text value. This function should not be
121−-- given a text value containing escapes.
120+-- | Make an 'Image' from a lazy text value. The text value should be
121+-- sanitized of escape sequences (ASCII 27) and carriage returns;
122+-- otherwise layout and attribute problems may result.
122123text :: Attr -> TL.Text -> Image
123124text a txt = let displayWidth = safeWctlwidth txt
124125 in HorizText a txt displayWidth (fromIntegral $! TL.length txt)
125126
126−-- | Make an 'Image' from a text value. This function should not be
127−-- given a text value containing escapes.
127+-- | Make an 'Image' from a text value. The text value should be
128+-- sanitized of escape sequences (ASCII 27) and carriage returns;
129+-- otherwise layout and attribute problems may result.
128130text' :: Attr -> T.Text -> Image
129131text' a txt = let displayWidth = safeWctwidth txt
130132 in HorizText a (TL.fromStrict txt) displayWidth (T.length txt)
@@ -138,8 +140,9 @@ char a c =
138140
139141-- | Make an image from a string of characters layed out on a single
140142-- row with the same display attribute. The string is assumed to be a
141−-- sequence of ISO-10646 characters. This function should not be given a
142−-- string containing escapes.
143+-- sequence of ISO-10646 characters. The input string should be
144+-- sanitized of escape sequences (ASCII 27) and carriage returns;
145+-- otherwise layout and attribute problems may result.
143146--
144147-- Note: depending on how the Haskell compiler represents string
145148-- literals, a string literal in a UTF-8 encoded source file, for
@@ -156,8 +159,7 @@ iso10646String a str =
156159--
157160-- This is an alias for iso10646String since the usual case is that a
158161-- literal string like "foo" is represented internally as a list of ISO
159−-- 10646 31 bit characters. This function should not be given a string
160−-- containing escapes.
162+-- 10646 31 bit characters.
161163--
162164-- Note: Keep in mind that GHC will compile source encoded as UTF-8
163165-- but the literal strings, while UTF-8 encoded in the source, will be