From 3c1714d76d01b513a2e31fbeae14feca438515fa Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 27 Jun 2020 21:35:52 +0200 Subject: Fix potential overflow --- crates/expect/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/expect/src') diff --git a/crates/expect/src/lib.rs b/crates/expect/src/lib.rs index aa95a88c5..dd7b96aab 100644 --- a/crates/expect/src/lib.rs +++ b/crates/expect/src/lib.rs @@ -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); -- cgit v1.2.3