Skip to content

Commit 5f6b200

Browse files
Do not change selections when opening FS entries (#21382)
Follow-up of #21375 When changing selections for FS entries, outline panel will be forced to change item to the first excerpt which is not what we want. Release Notes: - N/A
1 parent 4d54152 commit 5f6b200

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

crates/outline_panel/src/outline_panel.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,7 @@ impl OutlinePanel {
857857
fn open_entry(
858858
&mut self,
859859
entry: &PanelEntry,
860-
change_selection: bool,
860+
prefer_selection_change: bool,
861861
change_focus: bool,
862862
cx: &mut ViewContext<OutlinePanel>,
863863
) {
@@ -872,9 +872,11 @@ impl OutlinePanel {
872872
Point::new(0.0, -(active_editor.read(cx).file_header_size() as f32))
873873
};
874874

875+
let mut change_selection = prefer_selection_change;
875876
let scroll_target = match entry {
876877
PanelEntry::FoldedDirs(..) | PanelEntry::Fs(FsEntry::Directory(..)) => None,
877878
PanelEntry::Fs(FsEntry::ExternalFile(buffer_id, _)) => {
879+
change_selection = false;
878880
let scroll_target = multi_buffer_snapshot.excerpts().find_map(
879881
|(excerpt_id, buffer_snapshot, excerpt_range)| {
880882
if &buffer_snapshot.remote_id() == buffer_id {
@@ -888,6 +890,7 @@ impl OutlinePanel {
888890
Some(offset_from_top).zip(scroll_target)
889891
}
890892
PanelEntry::Fs(FsEntry::File(_, file_entry, ..)) => {
893+
change_selection = false;
891894
let scroll_target = self
892895
.project
893896
.update(cx, |project, cx| {

0 commit comments

Comments
 (0)