From d5d383c589837e775abfca1e975395d61be2fde0 Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Wed, 24 Jan 2024 19:44:02 -0700 Subject: [PATCH] Use the correct snapshot when calculating mouse positions (#6453) Release Notes: - Fixed a panic in calculating remote cursor positions --- crates/editor/src/element.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index dadcc62842360b1be401a2b0900b5a1a1d824dc8..b8a0e2839b6707d9092d8917787bde9acd0f1653 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -567,7 +567,7 @@ impl EditorElement { cx, ); hover_at(editor, Some(point), cx); - Self::update_visible_cursor(editor, point, cx); + Self::update_visible_cursor(editor, point, position_map, cx); } None => { update_inlay_link_and_hover_points( @@ -592,9 +592,10 @@ impl EditorElement { fn update_visible_cursor( editor: &mut Editor, point: DisplayPoint, + position_map: &PositionMap, cx: &mut ViewContext, ) { - let snapshot = editor.snapshot(cx); + let snapshot = &position_map.snapshot; let Some(hub) = editor.collaboration_hub() else { return; };