We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ae1d2a6 commit 4104207Copy full SHA for 4104207
prettyprinter/src/Prettyprinter/Internal.hs
@@ -491,7 +491,9 @@ unsafeTextWithoutNewlines text = case T.uncons text of
491
-- unsafeTextWithLength "😃" (realLength "😃")
492
-- @
493
unsafeTextWithLength :: Text -> Int -> Doc ann
494
-unsafeTextWithLength txt l = Text l txt
+unsafeTextWithLength txt l | T.null txt = Empty
495
+ | l == 1 && T.length txt == 1 = Char (T.head txt) -- no wide character or control
496
+ | otherwise = Text l txt
497
498
-- | The empty document behaves like @('pretty' "")@, so it has a height of 1.
499
-- This may lead to surprising behaviour if we expect it to bear no weight
0 commit comments