From b841b3eb7974d65db1c721f257c417838854747c Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 1 Dec 2021 11:44:33 +0100 Subject: [PATCH] Don't produce invalid intermediate edits in `Patch::compose` --- crates/text/src/patch.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/text/src/patch.rs b/crates/text/src/patch.rs index 8e51b5445f67f3c044f335f6e710c843f02e9771..266ad04f25b61cc99a1fa656514b9d7e587659ed 100644 --- a/crates/text/src/patch.rs +++ b/crates/text/src/patch.rs @@ -106,7 +106,7 @@ where new: new_start..new_end, }); - old_edit.old.start += overshoot; + old_edit.old.start = old_end; old_edit.new.start += overshoot; old_start = old_end; new_start = new_end; @@ -124,7 +124,7 @@ where }); new_edit.old.start += overshoot; - new_edit.new.start += overshoot; + new_edit.new.start = new_end; old_start = old_end; new_start = new_end; }