Update crates/text_edit/src/lib.rs

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
Anatol Ulrich 2021-11-03 15:44:46 +01:00 committed by GitHub
parent 83927e08a8
commit e8416bb644
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -123,7 +123,8 @@ pub fn union(&mut self, other: TextEdit) -> Result<(), TextEdit> {
self.indels.extend(other.indels);
check_disjoint_and_sort(&mut self.indels);
self.indels.dedup();
// Only dedup deletions and replacements, keep all insertions
self.indels.dedup_by(|a, b| a == b && !a.delete.is_empty());
Ok(())
}