mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-24 19:10:24 +00:00
Do not change selections when opening FS entries (#21382)
Some checks failed
Deploy Docs / Deploy Docs (push) Waiting to run
Docs / Check formatting (push) Waiting to run
Script / ShellCheck Scripts (push) Waiting to run
CI / Check Postgres and Protobuf migrations, mergability (push) Has been cancelled
CI / Check formatting and spelling (push) Has been cancelled
CI / (macOS) Run Clippy and tests (push) Has been cancelled
CI / (Linux) Run Clippy and tests (push) Has been cancelled
CI / (Linux) Build Remote Server (push) Has been cancelled
CI / (Windows) Run Clippy and tests (push) Has been cancelled
CI / Create a macOS bundle (push) Has been cancelled
CI / Create a Linux bundle (push) Has been cancelled
CI / Create arm64 Linux bundle (push) Has been cancelled
CI / Auto release preview (push) Has been cancelled
Some checks failed
Deploy Docs / Deploy Docs (push) Waiting to run
Docs / Check formatting (push) Waiting to run
Script / ShellCheck Scripts (push) Waiting to run
CI / Check Postgres and Protobuf migrations, mergability (push) Has been cancelled
CI / Check formatting and spelling (push) Has been cancelled
CI / (macOS) Run Clippy and tests (push) Has been cancelled
CI / (Linux) Run Clippy and tests (push) Has been cancelled
CI / (Linux) Build Remote Server (push) Has been cancelled
CI / (Windows) Run Clippy and tests (push) Has been cancelled
CI / Create a macOS bundle (push) Has been cancelled
CI / Create a Linux bundle (push) Has been cancelled
CI / Create arm64 Linux bundle (push) Has been cancelled
CI / Auto release preview (push) Has been cancelled
Follow-up of https://github.com/zed-industries/zed/pull/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
This commit is contained in:
parent
4d5415273e
commit
5f6b200d8d
1 changed files with 4 additions and 1 deletions
|
@ -857,7 +857,7 @@ impl OutlinePanel {
|
|||
fn open_entry(
|
||||
&mut self,
|
||||
entry: &PanelEntry,
|
||||
change_selection: bool,
|
||||
prefer_selection_change: bool,
|
||||
change_focus: bool,
|
||||
cx: &mut ViewContext<OutlinePanel>,
|
||||
) {
|
||||
|
@ -872,9 +872,11 @@ impl OutlinePanel {
|
|||
Point::new(0.0, -(active_editor.read(cx).file_header_size() as f32))
|
||||
};
|
||||
|
||||
let mut change_selection = prefer_selection_change;
|
||||
let scroll_target = match entry {
|
||||
PanelEntry::FoldedDirs(..) | PanelEntry::Fs(FsEntry::Directory(..)) => None,
|
||||
PanelEntry::Fs(FsEntry::ExternalFile(buffer_id, _)) => {
|
||||
change_selection = false;
|
||||
let scroll_target = multi_buffer_snapshot.excerpts().find_map(
|
||||
|(excerpt_id, buffer_snapshot, excerpt_range)| {
|
||||
if &buffer_snapshot.remote_id() == buffer_id {
|
||||
|
@ -888,6 +890,7 @@ impl OutlinePanel {
|
|||
Some(offset_from_top).zip(scroll_target)
|
||||
}
|
||||
PanelEntry::Fs(FsEntry::File(_, file_entry, ..)) => {
|
||||
change_selection = false;
|
||||
let scroll_target = self
|
||||
.project
|
||||
.update(cx, |project, cx| {
|
||||
|
|
Loading…
Reference in a new issue