mirror of
https://github.com/github/semantic.git
synced 2024-12-25 16:02:43 +03:00
Rewrite hasChanges to operate on a whole line.
This commit is contained in:
parent
dbeb71fb61
commit
a97fd599df
@ -81,9 +81,10 @@ split diff blobs = renderHtml
|
|||||||
numberedLinesToMarkup numberedLines = tr $ (runBothWith (<>) (renderLine <$> numberedLines <*> sources)) <> string "\n"
|
numberedLinesToMarkup numberedLines = tr $ (runBothWith (<>) (renderLine <$> numberedLines <*> sources)) <> string "\n"
|
||||||
|
|
||||||
renderLine :: (Int, Line (SplitDiff leaf Info)) -> Source Char -> Markup
|
renderLine :: (Int, Line (SplitDiff leaf Info)) -> Source Char -> Markup
|
||||||
renderLine (number, line) source = toMarkup $ Renderable (or $ hasChanges <$> line, number, Renderable . (,) source <$> line)
|
renderLine (number, line) source = toMarkup $ Renderable (hasChanges line, number, Renderable . (,) source <$> line)
|
||||||
|
|
||||||
hasChanges diff = or $ True <$ diff
|
hasChanges :: Line (SplitDiff leaf Info) -> Bool
|
||||||
|
hasChanges = or . fmap (or . (True <$))
|
||||||
|
|
||||||
-- | Something that can be rendered as markup.
|
-- | Something that can be rendered as markup.
|
||||||
newtype Renderable a = Renderable a
|
newtype Renderable a = Renderable a
|
||||||
|
Loading…
Reference in New Issue
Block a user