Don't panic when navigation data contains invalid anchors and/or points

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra 2022-04-27 16:51:48 +02:00
parent cde5a45318
commit c9478cab09
2 changed files with 26 additions and 3 deletions

View file

@ -250,7 +250,7 @@ impl Item for Editor {
let offset = if buffer.can_resolve(&data.cursor_anchor) {
data.cursor_anchor.to_point(&buffer)
} else {
buffer.clip_point(data.cursor_point, Bias::Left)
buffer.clip_point(data.cursor_position, Bias::Left)
};
let newest_selection = self.newest_selection_with_snapshot::<Point>(&buffer);