@@ -202,18 +202,17 @@ chomp d = Doc (fromList dl')
202202
203203outp :: (IsString a, Monoid a)
204204 => Int -> String -> DocState a
205−outp off s | off <= 0 = do
205+outp off s | off < 0 = do -- offset < 0 means newline characters
206206 st' <- get
207207 let rawpref = prefix st'
208208 when (column st' == 0 && usePrefix st' && not (null rawpref)) $ do
209209 let pref = reverse $ dropWhile isSpace $ reverse rawpref
210210 modify $ \st -> st{ output = fromString pref : output st
211211 , column = column st + realLength pref }
212− when (off < 0) $ do
213− modify $ \st -> st { output = fromString s : output st
214− , column = 0
215− , newlines = newlines st + 1 }
216−outp off s = do
212+ modify $ \st -> st { output = fromString s : output st
213+ , column = 0
214+ , newlines = newlines st + 1 }
215+outp off s = do -- offset >= 0 (0 might be combining char)
217216 st' <- get
218217 let pref = prefix st'
219218 when (column st' == 0 && usePrefix st' && not (null pref)) $ do