1
1
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:
Rob Rix 2016-03-02 08:03:49 -05:00
parent dbeb71fb61
commit a97fd599df

View File

@ -81,9 +81,10 @@ split diff blobs = renderHtml
numberedLinesToMarkup numberedLines = tr $ (runBothWith (<>) (renderLine <$> numberedLines <*> sources)) <> string "\n"
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.
newtype Renderable a = Renderable a