project panel: Focus editor when single-clicking on file and preview tabs are disabled (#20154)
Closes #4324 Release Notes: - Fixed an issue where single-clicking on a file in the project panel would not focus the editor, when preview tabs are disabled
This commit is contained in:
parent
de2483e132
commit
9a869f0c5f
1 changed files with 7 additions and 4 deletions
|
@ -51,7 +51,7 @@ use util::{maybe, ResultExt, TryFutureExt};
|
||||||
use workspace::{
|
use workspace::{
|
||||||
dock::{DockPosition, Panel, PanelEvent},
|
dock::{DockPosition, Panel, PanelEvent},
|
||||||
notifications::{DetachAndPromptErr, NotifyTaskExt},
|
notifications::{DetachAndPromptErr, NotifyTaskExt},
|
||||||
DraggedSelection, OpenInTerminal, SelectedEntry, Workspace,
|
DraggedSelection, OpenInTerminal, PreviewTabsSettings, SelectedEntry, Workspace,
|
||||||
};
|
};
|
||||||
use worktree::CreatedEntry;
|
use worktree::CreatedEntry;
|
||||||
|
|
||||||
|
@ -796,7 +796,8 @@ impl ProjectPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn open(&mut self, _: &Open, cx: &mut ViewContext<Self>) {
|
fn open(&mut self, _: &Open, cx: &mut ViewContext<Self>) {
|
||||||
self.open_internal(false, true, false, cx);
|
let preview_tabs_enabled = PreviewTabsSettings::get_global(cx).enabled;
|
||||||
|
self.open_internal(false, true, !preview_tabs_enabled, cx);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn open_permanent(&mut self, _: &OpenPermanent, cx: &mut ViewContext<Self>) {
|
fn open_permanent(&mut self, _: &OpenPermanent, cx: &mut ViewContext<Self>) {
|
||||||
|
@ -2721,12 +2722,14 @@ impl ProjectPanel {
|
||||||
} else if kind.is_dir() {
|
} else if kind.is_dir() {
|
||||||
this.toggle_expanded(entry_id, cx);
|
this.toggle_expanded(entry_id, cx);
|
||||||
} else {
|
} else {
|
||||||
|
let preview_tabs_enabled =
|
||||||
|
PreviewTabsSettings::get_global(cx).enabled;
|
||||||
let click_count = event.up.click_count;
|
let click_count = event.up.click_count;
|
||||||
this.open_entry(
|
this.open_entry(
|
||||||
entry_id,
|
entry_id,
|
||||||
cx.modifiers().secondary(),
|
cx.modifiers().secondary(),
|
||||||
click_count > 1,
|
!preview_tabs_enabled || click_count > 1,
|
||||||
click_count == 1,
|
!preview_tabs_enabled && click_count == 1,
|
||||||
cx,
|
cx,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue