1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 06:11:49 +03:00

Compute accurately-sized empty state for diff steps.

This commit is contained in:
Rob Rix 2017-03-13 12:11:31 -04:00
parent e7eb4aab0f
commit c2a3649cff

View File

@ -193,8 +193,8 @@ data MyersState = MyersState { forward :: !(Vector.Vector Int), backward :: !(Ve
emptyStateForStep :: Myers a b -> MyersState
emptyStateForStep step = case step of
Return _ -> MyersState Vector.empty Vector.empty
Then _ _ -> MyersState (Vector.replicate 100 0) (Vector.replicate 100 0)
Then (M m) _ -> let EditGraph as bs = editGraph m in MyersState (Vector.replicate (length as) 0) (Vector.replicate (length bs) 0)
_ -> MyersState Vector.empty Vector.empty
setForward :: Vector.Vector Int -> Myers a ()
setForward v = modify (\ s -> s { forward = v })