From 76edb6b848520ac3733b891cffdc92c0d350d371 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 13 Aug 2012 15:52:41 -0700 Subject: Pretty: Fixed bug that caused combining characters to be dropped. --- src/Text/Pandoc/Pretty.hs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/Text/Pandoc') diff --git a/src/Text/Pandoc/Pretty.hs b/src/Text/Pandoc/Pretty.hs index 6cb6bce18..211fdf20e 100644 --- a/src/Text/Pandoc/Pretty.hs +++ b/src/Text/Pandoc/Pretty.hs @@ -202,18 +202,17 @@ chomp d = Doc (fromList dl') outp :: (IsString a, Monoid a) => Int -> String -> DocState a -outp off s | off <= 0 = do +outp off s | off < 0 = do -- offset < 0 means newline characters st' <- get let rawpref = prefix st' when (column st' == 0 && usePrefix st' && not (null rawpref)) $ do let pref = reverse $ dropWhile isSpace $ reverse rawpref modify $ \st -> st{ output = fromString pref : output st , column = column st + realLength pref } - when (off < 0) $ do - modify $ \st -> st { output = fromString s : output st - , column = 0 - , newlines = newlines st + 1 } -outp off s = do + modify $ \st -> st { output = fromString s : output st + , column = 0 + , newlines = newlines st + 1 } +outp off s = do -- offset >= 0 (0 might be combining char) st' <- get let pref = prefix st' when (column st' == 0 && usePrefix st' && not (null pref)) $ do -- cgit v1.2.3