Optimize Buffer::set_rich_text for when the buffer is reconstructed

This commit is contained in:
koe 2024-08-31 00:56:21 -05:00 committed by Jeremy Soller
parent c751217020
commit b68f4ad5c6
6 changed files with 421 additions and 69 deletions

View file

@ -373,4 +373,11 @@ impl AttrsList {
}
new
}
/// Resets the attributes with new defaults.
pub(crate) fn reset(mut self, default: Attrs) -> Self {
self.defaults = AttrsOwned::new(default);
self.spans.clear();
self
}
}