diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index c67a9c233f..357e0237c7 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -850,8 +850,8 @@ struct ClipboardSelection { pub struct NavigationData { // Matching offsets for anchor and scroll_top_anchor allows us to recreate the anchor if the buffer // has since been closed - anchor: Anchor, - offset: usize, + cursor_anchor: Anchor, + cursor_offset: usize, scroll_position: Vector2F, scroll_top_anchor: Anchor, scroll_top_offset: usize, @@ -3912,8 +3912,8 @@ impl Editor { } nav_history.push(Some(NavigationData { - anchor: position, - offset, + cursor_anchor: position, + cursor_offset: offset, scroll_position: self.scroll_position, scroll_top_anchor: self.scroll_top_anchor.clone(), scroll_top_offset, diff --git a/crates/editor/src/items.rs b/crates/editor/src/items.rs index 7e767b10a2..9fe6e21b71 100644 --- a/crates/editor/src/items.rs +++ b/crates/editor/src/items.rs @@ -247,10 +247,10 @@ impl Item for Editor { fn navigate(&mut self, data: Box, cx: &mut ViewContext) -> bool { if let Some(data) = data.downcast_ref::() { let buffer = self.buffer.read(cx).read(cx); - let offset = if buffer.can_resolve(&data.anchor) { - data.anchor.to_offset(&buffer) + let offset = if buffer.can_resolve(&data.cursor_anchor) { + data.cursor_anchor.to_offset(&buffer) } else { - buffer.clip_offset(data.offset, Bias::Left) + buffer.clip_offset(data.cursor_offset, Bias::Left) }; let newest_selection = self.newest_selection_with_snapshot::(&buffer);