tasks: Wire through click handlers in new tasks modal (#11854)
🤦
Spotted by @SomeoneToIgnore
Release Notes:
- N/A
This commit is contained in:
parent
43d79af94a
commit
a59a388c15
1 changed files with 27 additions and 20 deletions
|
@ -3,7 +3,7 @@ use std::sync::Arc;
|
||||||
use crate::active_item_selection_properties;
|
use crate::active_item_selection_properties;
|
||||||
use fuzzy::{StringMatch, StringMatchCandidate};
|
use fuzzy::{StringMatch, StringMatchCandidate};
|
||||||
use gpui::{
|
use gpui::{
|
||||||
impl_actions, rems, AnyElement, AppContext, DismissEvent, EventEmitter, FocusableView,
|
impl_actions, rems, Action, AnyElement, AppContext, DismissEvent, EventEmitter, FocusableView,
|
||||||
InteractiveElement, Model, ParentElement, Render, SharedString, Styled, Subscription, View,
|
InteractiveElement, Model, ParentElement, Render, SharedString, Styled, Subscription, View,
|
||||||
ViewContext, VisualContext, WeakView,
|
ViewContext, VisualContext, WeakView,
|
||||||
};
|
};
|
||||||
|
@ -475,18 +475,19 @@ impl PickerDelegate for TasksModalDelegate {
|
||||||
Button::new("edit-current-task", edit_entry_label)
|
Button::new("edit-current-task", edit_entry_label)
|
||||||
.label_size(LabelSize::Small)
|
.label_size(LabelSize::Small)
|
||||||
.key_binding(keybind)
|
.key_binding(keybind)
|
||||||
|
.on_click(|_, cx| {
|
||||||
|
cx.dispatch_action(picker::UseSelectedQuery.boxed_clone())
|
||||||
|
})
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.map(|this| {
|
.map(|this| {
|
||||||
if current_modifiers.alt || self.matches.is_empty() {
|
if (current_modifiers.alt || self.matches.is_empty()) && !self.prompt.is_empty()
|
||||||
this.children(
|
{
|
||||||
KeyBinding::for_action(
|
let action = picker::ConfirmInput {
|
||||||
&picker::ConfirmInput {
|
|
||||||
secondary: current_modifiers.secondary(),
|
secondary: current_modifiers.secondary(),
|
||||||
},
|
}
|
||||||
cx,
|
.boxed_clone();
|
||||||
)
|
this.children(KeyBinding::for_action(&*action, cx).map(|keybind| {
|
||||||
.map(|keybind| {
|
|
||||||
let spawn_oneshot_label = if current_modifiers.secondary() {
|
let spawn_oneshot_label = if current_modifiers.secondary() {
|
||||||
"Spawn oneshot without history"
|
"Spawn oneshot without history"
|
||||||
} else {
|
} else {
|
||||||
|
@ -496,8 +497,8 @@ impl PickerDelegate for TasksModalDelegate {
|
||||||
Button::new("spawn-onehshot", spawn_oneshot_label)
|
Button::new("spawn-onehshot", spawn_oneshot_label)
|
||||||
.label_size(LabelSize::Small)
|
.label_size(LabelSize::Small)
|
||||||
.key_binding(keybind)
|
.key_binding(keybind)
|
||||||
}),
|
.on_click(move |_, cx| cx.dispatch_action(action.boxed_clone()))
|
||||||
)
|
}))
|
||||||
} else if current_modifiers.secondary() {
|
} else if current_modifiers.secondary() {
|
||||||
this.children(KeyBinding::for_action(&menu::SecondaryConfirm, cx).map(
|
this.children(KeyBinding::for_action(&menu::SecondaryConfirm, cx).map(
|
||||||
|keybind| {
|
|keybind| {
|
||||||
|
@ -509,6 +510,9 @@ impl PickerDelegate for TasksModalDelegate {
|
||||||
Button::new("spawn", label)
|
Button::new("spawn", label)
|
||||||
.label_size(LabelSize::Small)
|
.label_size(LabelSize::Small)
|
||||||
.key_binding(keybind)
|
.key_binding(keybind)
|
||||||
|
.on_click(move |_, cx| {
|
||||||
|
cx.dispatch_action(menu::SecondaryConfirm.boxed_clone())
|
||||||
|
})
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
} else {
|
} else {
|
||||||
|
@ -519,6 +523,9 @@ impl PickerDelegate for TasksModalDelegate {
|
||||||
Button::new("spawn", run_entry_label)
|
Button::new("spawn", run_entry_label)
|
||||||
.label_size(LabelSize::Small)
|
.label_size(LabelSize::Small)
|
||||||
.key_binding(keybind)
|
.key_binding(keybind)
|
||||||
|
.on_click(|_, cx| {
|
||||||
|
cx.dispatch_action(menu::Confirm.boxed_clone());
|
||||||
|
})
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue