summaryrefslogtreecommitdiff
path: root/Text/Pandoc/Readers/Plain.hs
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2017-12-21 09:23:21 +0300
committerdefanor <defanor@uberspace.net>2017-12-21 09:23:21 +0300
commitb32900a7d426f06ee1bd2f69d8cf7899034f5470 (patch)
tree33496f0d50e87b286da038973cb294079da3dafc /Text/Pandoc/Readers/Plain.hs
parentdbd5740dea0ad6119cbef2b3b1cccf1e865beaca (diff)
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.
Diffstat (limited to 'Text/Pandoc/Readers/Plain.hs')
-rw-r--r--Text/Pandoc/Readers/Plain.hs4
1 files changed, 2 insertions, 2 deletions
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')