Don't reuse excerpt ids in MultiBuffer

This prevents anchors from swapping their ordering, which was causing issues in FoldMap.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
This commit is contained in:
Nathan Sobo 2022-03-11 08:50:50 -07:00
parent 134496ce8f
commit 5407f25c94
2 changed files with 34 additions and 2 deletions

View file

@ -49,6 +49,30 @@ impl Default for Locator {
}
}
impl sum_tree::Item for Locator {
type Summary = Locator;
fn summary(&self) -> Self::Summary {
self.clone()
}
}
impl sum_tree::KeyedItem for Locator {
type Key = Locator;
fn key(&self) -> Self::Key {
self.clone()
}
}
impl sum_tree::Summary for Locator {
type Context = ();
fn add_summary(&mut self, summary: &Self, _: &()) {
self.assign(summary);
}
}
#[cfg(test)]
mod tests {
use super::*;