diff --git a/src/Renderer/Split.hs b/src/Renderer/Split.hs index 1874f68e2..f47e2606b 100644 --- a/src/Renderer/Split.hs +++ b/src/Renderer/Split.hs @@ -100,8 +100,8 @@ instance ToMarkup f => ToMarkup (Renderable (Source Char, Info, Syntax a (f, Ran Indexed children -> ul . mconcat $ wrapIn li <$> contentElements children Fixed children -> ul . mconcat $ wrapIn li <$> contentElements children Keyed children -> dl . mconcat $ wrapIn dd <$> contentElements children - where markupForSeparatorAndChild :: ToMarkup f => ([Markup], Int) -> (f, Range) -> ([Markup], Int) - markupForSeparatorAndChild (rows, previous) (child, range) = (rows ++ [ string (toString $ slice (Range previous $ start range) source), toMarkup child ], end range) + where markupForSeparatorAndChild :: ToMarkup f => (f, Range) -> ([Markup], Int) -> ([Markup], Int) + markupForSeparatorAndChild (child, range) (rows, next) = (string (toString $ slice (Range (start range) next) source) : toMarkup child : rows, end range) wrapIn _ l@Blaze.Leaf{} = l wrapIn _ l@Blaze.CustomLeaf{} = l @@ -109,7 +109,7 @@ instance ToMarkup f => ToMarkup (Renderable (Source Char, Info, Syntax a (f, Ran wrapIn _ l@Blaze.Comment{} = l wrapIn f p = f p - contentElements children = let (elements, previous) = foldl' markupForSeparatorAndChild ([], start range) children in + contentElements children = let (elements, previous) = foldr' markupForSeparatorAndChild ([], end range) children in elements ++ [ string . toString $ slice (Range previous $ end range) source ] instance ToMarkup (Renderable (Source Char, Term a Info)) where