Implement BlockSnapshot::line_len, use it in DisplayMap

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Max Brunsfeld 2021-11-17 14:56:05 -08:00
parent 00b5cc472e
commit 707ffe8ff3
4 changed files with 41 additions and 15 deletions

View file

@ -249,6 +249,11 @@ impl Rope {
self.summary().lines_utf16
}
}
pub fn line_len(&self, row: u32) -> u32 {
self.clip_point(Point::new(row, u32::MAX), Bias::Left)
.column
}
}
impl<'a> From<&'a str> for Rope {