Smarter sorting and application of fix to handle multiple replacements

This commit is contained in:
Ng Zhi An 2018-11-02 22:13:49 -07:00
parent d5ba41035b
commit 3471ad45b1
3 changed files with 57 additions and 39 deletions

View file

@ -255,15 +255,13 @@ replaceStart id params n r =
repString = r
}
replaceEnd id params n r =
-- because of the way we count columns 1-based
-- we have to offset end columns by 1
let tp = tokenPositions params
(_, end) = tp Map.! id
new_start = end {
posColumn = posColumn end - n + 1
posColumn = posColumn end - n
}
new_end = end {
posColumn = posColumn end + 1
posColumn = posColumn end
}
in
newReplacement {