Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

file_finder: Add SelectNext action #25418

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion crates/file_finder/src/file_finder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ use workspace::{
Workspace,
};

actions!(file_finder, [SelectPrev, ToggleMenu]);
actions!(file_finder, [SelectPrev, SelectNext, ToggleMenu]);

impl ModalView for FileFinder {
fn on_before_dismiss(
Expand Down Expand Up @@ -204,6 +204,11 @@ impl FileFinder {
window.dispatch_action(Box::new(menu::SelectPrev), cx);
}

fn handle_select_next(&mut self, _: &SelectNext, window: &mut Window, cx: &mut Context<Self>) {
self.init_modifiers = Some(window.modifiers());
window.dispatch_action(Box::new(menu::SelectNext), cx);
}

fn handle_toggle_menu(&mut self, _: &ToggleMenu, window: &mut Window, cx: &mut Context<Self>) {
self.picker.update(cx, |picker, cx| {
let menu_handle = &picker.delegate.popover_menu_handle;
Expand Down Expand Up @@ -317,6 +322,7 @@ impl Render for FileFinder {
.w(modal_max_width)
.on_modifiers_changed(cx.listener(Self::handle_modifiers_changed))
.on_action(cx.listener(Self::handle_select_prev))
.on_action(cx.listener(Self::handle_select_next))
.on_action(cx.listener(Self::handle_toggle_menu))
.on_action(cx.listener(Self::go_to_file_split_left))
.on_action(cx.listener(Self::go_to_file_split_right))
Expand Down
Loading