diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index e05837740d4c50fbe7e02e51272bd6340884ec8a..7af3f5460def3d55a9d661e3b29724e0d392e637 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -6374,8 +6374,8 @@ impl Editor { .range .to_offset(definition.target.buffer.read(cx)); + let range = self.range_for_match(&range); if Some(&definition.target.buffer) == self.buffer.read(cx).as_singleton().as_ref() { - let range = self.range_for_match(&range); self.change_selections(Some(Autoscroll::fit()), cx, |s| { s.select_ranges([range]); }); @@ -6392,7 +6392,6 @@ impl Editor { // When selecting a definition in a different buffer, disable the nav history // to avoid creating a history entry at the previous cursor location. pane.update(cx, |pane, _| pane.disable_history()); - let range = target_editor.range_for_match(&range); target_editor.change_selections(Some(Autoscroll::fit()), cx, |s| { s.select_ranges([range]); });