mirror of
https://github.com/github/semantic.git
synced 2024-12-23 14:54:16 +03:00
Revert "Only take the first line from each child."
This reverts commit 439e9358ee46be695cf651ed35dc9f988e757b9d.
This commit is contained in:
parent
8d808e32ca
commit
e5192708e0
@ -155,20 +155,21 @@ getRange :: SplitDiff leaf Info -> Range
|
|||||||
getRange (Free (Annotated (Info range _) _)) = range
|
getRange (Free (Annotated (Info range _) _)) = range
|
||||||
getRange (Pure patch) | Info range _ :< _ <- getSplitTerm patch = range
|
getRange (Pure patch) | Info range _ :< _ <- getSplitTerm patch = range
|
||||||
|
|
||||||
intersects :: Join These Range -> Join These (SplitDiff leaf Info) -> Join These Bool
|
intersects :: Join These Range -> AlignedDiff leaf -> Join These Bool
|
||||||
intersects ranges child = fromMaybe (False <$ child) $ intersectsChild <$> ranges `applyThese` child
|
intersects ranges childLines | (line:_) <- childLines = fromMaybe (False <$ line) $ intersectsChild <$> ranges `applyThese` line
|
||||||
|
| otherwise = False <$ ranges
|
||||||
|
|
||||||
intersectsChild :: Range -> SplitDiff leaf Info -> Bool
|
intersectsChild :: Range -> SplitDiff leaf Info -> Bool
|
||||||
intersectsChild range child = end (getRange child) <= end range
|
intersectsChild range child = end (getRange child) <= end range
|
||||||
|
|
||||||
spanMergeable :: Join These Range -> [AlignedDiff leaf] -> ([AlignedDiff leaf], [AlignedDiff leaf])
|
spanMergeable :: Join These Range -> [AlignedDiff leaf] -> ([AlignedDiff leaf], [AlignedDiff leaf])
|
||||||
spanMergeable ranges children | ((firstChildLine:restChildLines):rest) <- children
|
spanMergeable ranges children | (child:rest) <- children
|
||||||
, ~(merge, nope) <- spanMergeable ranges (if null restChildLines then rest else restChildLines : rest)
|
, ~(merge, nope) <- spanMergeable ranges rest
|
||||||
, ~(this, that) <- split firstChildLine
|
, ~(this, that) <- unzip $ split <$> child
|
||||||
= case fromThese False False . runJoin $ intersects ranges firstChildLine of
|
= case fromThese False False . runJoin $ intersects ranges child of
|
||||||
(True, True) -> ([firstChildLine] : merge, nope)
|
(True, True) -> (child:merge, nope)
|
||||||
(True, False) -> (this : merge, that : nope)
|
(True, False) -> (this ++ merge, that ++ nope)
|
||||||
(False, True) -> (that : merge, this : nope)
|
(False, True) -> (that ++ merge, this ++ nope)
|
||||||
_ -> ([], children)
|
_ -> ([], children)
|
||||||
| otherwise = ([], [])
|
| otherwise = ([], [])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user