Add line_len snapshot method
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
This commit is contained in:
parent
ab7dd80423
commit
2ba3262f29
1 changed files with 8 additions and 3 deletions
|
@ -549,7 +549,7 @@ impl InlaySnapshot {
|
||||||
|
|
||||||
match bias {
|
match bias {
|
||||||
Bias::Left => cursor.end(&()),
|
Bias::Left => cursor.end(&()),
|
||||||
Bias::Right => *cursor.start(),
|
Bias::Right => cursor.start(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -618,8 +618,13 @@ impl InlaySnapshot {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn line_len(&self, row: u32) -> u32 {
|
pub fn line_len(&self, row: u32) -> u32 {
|
||||||
// TODO kb copied from suggestion_map
|
let line_start = self.to_offset(InlayPoint::new(row, 0)).0;
|
||||||
self.suggestion_snapshot.line_len(row)
|
let line_end = if row >= self.max_point().row() {
|
||||||
|
self.len().0
|
||||||
|
} else {
|
||||||
|
self.to_offset(InlayPoint::new(row + 1, 0)).0 - 1
|
||||||
|
};
|
||||||
|
(line_end - line_start) as u32
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn chunks<'a>(
|
pub fn chunks<'a>(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue