Fix clipping at end of line in vim mode with inlay hints (#23975)
Closes #23877 Co-Authored-By: Ben <ben@zed.dev> Co-Authored-By: Michael <michael@zed.dev> Release Notes: - vim: Fix navigating to end of line with inlay hints --------- Co-authored-by: Ben <ben@zed.dev> Co-authored-by: Michael <michael@zed.dev>
This commit is contained in:
parent
5914ccdc51
commit
cb15753694
2 changed files with 47 additions and 12 deletions
|
@ -1068,13 +1068,15 @@ impl DisplaySnapshot {
|
|||
DisplayPoint(self.block_snapshot.clip_point(point.0, bias))
|
||||
}
|
||||
|
||||
pub fn clip_at_line_end(&self, point: DisplayPoint) -> DisplayPoint {
|
||||
let mut point = point.0;
|
||||
if point.column == self.line_len(DisplayRow(point.row)) {
|
||||
point.column = point.column.saturating_sub(1);
|
||||
point = self.block_snapshot.clip_point(point, Bias::Left);
|
||||
pub fn clip_at_line_end(&self, display_point: DisplayPoint) -> DisplayPoint {
|
||||
let mut point = self.display_point_to_point(display_point, Bias::Left);
|
||||
|
||||
if point.column != self.buffer_snapshot.line_len(MultiBufferRow(point.row)) {
|
||||
return display_point;
|
||||
}
|
||||
DisplayPoint(point)
|
||||
point.column = point.column.saturating_sub(1);
|
||||
point = self.buffer_snapshot.clip_point(point, Bias::Left);
|
||||
self.point_to_display_point(point, Bias::Left)
|
||||
}
|
||||
|
||||
pub fn folds_in_range<T>(&self, range: Range<T>) -> impl Iterator<Item = &Fold>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue