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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user