Introduce rope::Cursor::summary to avoid slicing only to get a summary

This also deletes `Rope::slice`, as it's just a convenience method that
can be easily re-implemented by using the cursor.
This commit is contained in:
Antonio Scandurra
2021-05-15 11:29:48 +02:00
parent def0aa98b2
commit 76a74e431e
2 changed files with 54 additions and 19 deletions
+1 -2
View File
@@ -600,8 +600,7 @@ impl Buffer {
}
pub fn text_summary_for_range(&self, range: Range<usize>) -> TextSummary {
// TODO: Use a dedicated ::summarize method in Rope.
self.visible_text.slice(range).summary()
self.visible_text.cursor(range.start).summary(range.end)
}
pub fn len(&self) -> usize {