Don't open file finder menu on command (#25097)

Closes #24740

Release Notes:

- Don't open the split menu in the file finder when command is pressed
This commit is contained in:
Conrad Irwin 2025-02-18 14:27:10 -07:00 committed by GitHub
parent bff1548b48
commit 48f87a8d9a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 53 deletions

View file

@ -767,13 +767,7 @@
} }
}, },
{ {
"context": "FileFinder", "context": "FileFinder || (FileFinder > Picker > Editor) || (FileFinder > Picker > menu)",
"bindings": {
"ctrl": "file_finder::ToggleMenu"
}
},
{
"context": "FileFinder && !menu_open",
"bindings": { "bindings": {
"ctrl-shift-p": "file_finder::SelectPrev", "ctrl-shift-p": "file_finder::SelectPrev",
"ctrl-j": "pane::SplitDown", "ctrl-j": "pane::SplitDown",
@ -782,15 +776,6 @@
"ctrl-l": "pane::SplitRight" "ctrl-l": "pane::SplitRight"
} }
}, },
{
"context": "FileFinder && menu_open",
"bindings": {
"j": "pane::SplitDown",
"k": "pane::SplitUp",
"h": "pane::SplitLeft",
"l": "pane::SplitRight"
}
},
{ {
"context": "TabSwitcher", "context": "TabSwitcher",
"bindings": { "bindings": {

View file

@ -785,14 +785,7 @@
} }
}, },
{ {
"context": "FileFinder", "context": "FileFinder || (FileFinder > Picker > Editor) || (FileFinder > Picker > menu)",
"use_key_equivalents": true,
"bindings": {
"cmd": "file_finder::ToggleMenu"
}
},
{
"context": "FileFinder && !menu_open",
"use_key_equivalents": true, "use_key_equivalents": true,
"bindings": { "bindings": {
"cmd-shift-p": "file_finder::SelectPrev", "cmd-shift-p": "file_finder::SelectPrev",
@ -802,16 +795,6 @@
"cmd-l": "pane::SplitRight" "cmd-l": "pane::SplitRight"
} }
}, },
{
"context": "FileFinder && menu_open",
"use_key_equivalents": true,
"bindings": {
"j": "pane::SplitDown",
"k": "pane::SplitUp",
"h": "pane::SplitLeft",
"l": "pane::SplitRight"
}
},
{ {
"context": "TabSwitcher", "context": "TabSwitcher",
"use_key_equivalents": true, "use_key_equivalents": true,

View file

@ -34,7 +34,7 @@ use std::{
}; };
use text::Point; use text::Point;
use ui::{ use ui::{
prelude::*, ContextMenu, HighlightedLabel, KeyBinding, ListItem, ListItemSpacing, PopoverMenu, prelude::*, ContextMenu, HighlightedLabel, ListItem, ListItemSpacing, PopoverMenu,
PopoverMenuHandle, PopoverMenuHandle,
}; };
use util::{paths::PathWithPosition, post_inc, ResultExt}; use util::{paths::PathWithPosition, post_inc, ResultExt};
@ -1448,11 +1448,7 @@ impl PickerDelegate for FileFinderDelegate {
) )
} }
fn render_footer( fn render_footer(&self, _: &mut Window, cx: &mut Context<Picker<Self>>) -> Option<AnyElement> {
&self,
window: &mut Window,
cx: &mut Context<Picker<Self>>,
) -> Option<AnyElement> {
let context = self.focus_handle.clone(); let context = self.focus_handle.clone();
Some( Some(
h_flex() h_flex()
@ -1463,11 +1459,9 @@ impl PickerDelegate for FileFinderDelegate {
.border_t_1() .border_t_1()
.border_color(cx.theme().colors().border_variant) .border_color(cx.theme().colors().border_variant)
.child( .child(
Button::new("open-selection", "Open") Button::new("open-selection", "Open").on_click(|_, window, cx| {
.key_binding(KeyBinding::for_action(&menu::Confirm, window, cx)) window.dispatch_action(menu::Confirm.boxed_clone(), cx)
.on_click(|_, window, cx| { }),
window.dispatch_action(menu::Confirm.boxed_clone(), cx)
}),
) )
.child( .child(
PopoverMenu::new("menu-popover") PopoverMenu::new("menu-popover")
@ -1475,14 +1469,8 @@ impl PickerDelegate for FileFinderDelegate {
.attach(gpui::Corner::TopRight) .attach(gpui::Corner::TopRight)
.anchor(gpui::Corner::BottomRight) .anchor(gpui::Corner::BottomRight)
.trigger( .trigger(
Button::new("actions-trigger", "Split Options") Button::new("actions-trigger", "Split…")
.selected_label_color(Color::Accent) .selected_label_color(Color::Accent),
.key_binding(KeyBinding::for_action_in(
&ToggleMenu,
&context,
window,
cx,
)),
) )
.menu({ .menu({
move |window, cx| { move |window, cx| {