@@ -23,6 +23,7 @@ use postage::{oneshot, prelude::*};
use regex::Regex;
pub use rope::*;
pub use selection::*;
+use smallvec::SmallVec;
use std::{
borrow::Cow,
cmp::{self, Ordering, Reverse},
@@ -541,7 +542,7 @@ pub struct Fragment {
pub insertion_offset: usize,
pub len: usize,
pub visible: bool,
- pub deletions: HashSet<clock::Lamport>,
+ pub deletions: SmallVec<[clock::Lamport; 2]>,
pub max_undos: clock::Global,
}
@@ -948,7 +949,7 @@ impl Buffer {
intersection.insertion_offset += fragment_start - old_fragments.start().visible;
intersection.id =
Locator::between(&new_fragments.summary().max_id, &intersection.id);
- intersection.deletions.insert(timestamp);
+ intersection.deletions.push(timestamp);
intersection.visible = false;
}
if intersection.len > 0 {
@@ -1197,7 +1198,7 @@ impl Buffer {
fragment_start - old_fragments.start().0.full_offset();
intersection.id =
Locator::between(&new_fragments.summary().max_id, &intersection.id);
- intersection.deletions.insert(timestamp);
+ intersection.deletions.push(timestamp);
intersection.visible = false;
insertion_slices.push(InsertionSlice::from_fragment(timestamp, &intersection));
}