Use the correct snapshot when calculating mouse positions (#6453)

Release Notes:

- Fixed a panic in calculating remote cursor positions
This commit is contained in:
Conrad Irwin 2024-01-24 19:44:02 -07:00 committed by GitHub
commit a181dc8d58
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -567,7 +567,7 @@ impl EditorElement {
cx, cx,
); );
hover_at(editor, Some(point), cx); hover_at(editor, Some(point), cx);
Self::update_visible_cursor(editor, point, cx); Self::update_visible_cursor(editor, point, position_map, cx);
} }
None => { None => {
update_inlay_link_and_hover_points( update_inlay_link_and_hover_points(
@ -592,9 +592,10 @@ impl EditorElement {
fn update_visible_cursor( fn update_visible_cursor(
editor: &mut Editor, editor: &mut Editor,
point: DisplayPoint, point: DisplayPoint,
position_map: &PositionMap,
cx: &mut ViewContext<Editor>, cx: &mut ViewContext<Editor>,
) { ) {
let snapshot = editor.snapshot(cx); let snapshot = &position_map.snapshot;
let Some(hub) = editor.collaboration_hub() else { let Some(hub) = editor.collaboration_hub() else {
return; return;
}; };