add CellOffsets::ranges helper

This commit is contained in:
Brent Westbrook 2025-09-22 16:17:41 -04:00
parent 5bfe3f2440
commit 76e63b36bd

View file

@ -308,6 +308,13 @@ impl CellOffsets {
}) })
.is_ok() .is_ok()
} }
/// Returns an iterator over [`TextRange`]s covered by each cell.
pub fn ranges(&self) -> impl Iterator<Item = TextRange> {
self.iter()
.tuple_windows()
.map(|(start, end)| TextRange::new(*start, *end))
}
} }
impl Deref for CellOffsets { impl Deref for CellOffsets {