Fix race conditions and bugs in Buffer::reload

This commit is contained in:
Max Brunsfeld
2023-11-16 16:03:14 -08:00
parent 89d73f713a
commit 5f1acae0d3
5 changed files with 123 additions and 44 deletions
+5 -1
View File
@@ -41,6 +41,10 @@ impl Rope {
Self::default()
}
pub fn text_fingerprint(text: &str) -> RopeFingerprint {
bromberg_sl2::hash_strict(text.as_bytes())
}
pub fn append(&mut self, rope: Rope) {
let mut chunks = rope.chunks.cursor::<()>();
chunks.next(&());
@@ -931,7 +935,7 @@ impl<'a> From<&'a str> for ChunkSummary {
fn from(text: &'a str) -> Self {
Self {
text: TextSummary::from(text),
fingerprint: bromberg_sl2::hash_strict(text.as_bytes()),
fingerprint: Rope::text_fingerprint(text),
}
}
}