Fix potential overflow

This commit is contained in:
Aleksey Kladov 2020-06-27 21:35:52 +02:00
parent 53787c7eba
commit 3c1714d76d

View file

@ -188,8 +188,8 @@ impl Patchwork {
.fold((0usize, 0usize), |(x1, y1), (x2, y2)| (x1 + x2, y1 + y2));
for pos in &mut [&mut range.start, &mut range.end] {
**pos -= delete;
**pos += insert;
**pos -= delete
}
self.text.replace_range(range, &patch);