From b32900a7d426f06ee1bd2f69d8cf7899034f5470 Mon Sep 17 00:00:00 2001 From: defanor Date: Thu, 21 Dec 2017 09:23:21 +0300 Subject: Retain position on redisplay, reload, etc Based on line numbers that are attached to document blocks, not dependent on window/terminal width. Some bits can still be refined/refactored, but here's the initial support. --- Text/Pandoc/Readers/Plain.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Text/Pandoc/Readers/Plain.hs') diff --git a/Text/Pandoc/Readers/Plain.hs b/Text/Pandoc/Readers/Plain.hs index 3e64b6b..a66b1cd 100644 --- a/Text/Pandoc/Readers/Plain.hs +++ b/Text/Pandoc/Readers/Plain.hs @@ -43,6 +43,6 @@ lineToInlines s = let (cur, next) = break (== ' ') s -- | Reads plain text, always succeeding and producing a single -- 'Plain' block. readPlain :: PandocMonad m => T.Text -> m Pandoc -readPlain = pure . Pandoc mempty . pure . Plain . - concatMap (\l -> (lineToInlines $ T.unpack l) ++ [LineBreak]) +readPlain = pure . Pandoc mempty . pure . LineBlock + . map (\l -> (lineToInlines $ T.unpack l)) . T.lines . T.filter (/= '\r') -- cgit v1.2.3