mirror of
https://github.com/github/semantic.git
synced 2024-12-28 09:21:35 +03:00
Fold right through separators & children when rendering split diffs.
This commit is contained in:
parent
169dbea2a5
commit
d623699573
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user