mirror of
https://github.com/github/semantic.git
synced 2025-01-03 21:16:12 +03:00
Correct the accumulation of the terminal context.
This commit is contained in:
parent
fe5b6d2011
commit
59e6577f5e
@ -47,7 +47,11 @@ annotatedToRows (Annotated (Info left _ leftCategories, Info right _ rightCatego
|
||||
annotatedToRows (Annotated (Info left _ leftCategories, Info right _ rightCategories) (Indexed i)) before after = (bimap (Ul $ classify leftCategories) (Ul $ classify rightCategories) <$> rows, left, right)
|
||||
where
|
||||
rows = appendRemainder $ foldl sumRows ([], start left, start right) i
|
||||
appendRemainder (rows, previousLeft, previousRight) = adjoinRows rows [ Row (Text <$> lines (substring (Range previousLeft $ end left) before)) (Text <$> lines (substring (Range previousRight $ end right) after)) ]
|
||||
appendRemainder (rows, previousLeft, previousRight) = adjoinRows rows contextRows
|
||||
where
|
||||
contextRows = uncurry rowFromMaybeRows <$> zipMaybe leftElements rightElements
|
||||
leftElements = Text <$> lines (substring (Range previousLeft $ end left) before)
|
||||
rightElements = Text <$> lines (substring (Range previousRight $ end right) after)
|
||||
sumRows (rows, previousLeft, previousRight) child = (rows `adjoinRows` contextRows `adjoinRows` childRows, end leftChildRange, end rightChildRange)
|
||||
where
|
||||
(childRows, leftChildRange, rightChildRange) = diffToRows child before after
|
||||
|
Loading…
Reference in New Issue
Block a user