Do not spawn oneshot tasks from blank prompts (#10115)
This commit is contained in:
parent
c4ceeb715a
commit
027897e003
1 changed files with 5 additions and 0 deletions
|
@ -75,6 +75,10 @@ impl TasksModalDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn spawn_oneshot(&mut self, cx: &mut AppContext) -> Option<Arc<dyn Task>> {
|
fn spawn_oneshot(&mut self, cx: &mut AppContext) -> Option<Arc<dyn Task>> {
|
||||||
|
if self.prompt.trim().is_empty() {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
self.inventory
|
self.inventory
|
||||||
.update(cx, |inventory, _| inventory.source::<OneshotSource>())?
|
.update(cx, |inventory, _| inventory.source::<OneshotSource>())?
|
||||||
.update(cx, |oneshot_source, _| {
|
.update(cx, |oneshot_source, _| {
|
||||||
|
@ -373,6 +377,7 @@ impl PickerDelegate for TasksModalDelegate {
|
||||||
}
|
}
|
||||||
Some(spawn_prompt.command)
|
Some(spawn_prompt.command)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn confirm_input(&mut self, omit_history_entry: bool, cx: &mut ViewContext<Picker<Self>>) {
|
fn confirm_input(&mut self, omit_history_entry: bool, cx: &mut ViewContext<Picker<Self>>) {
|
||||||
let Some(task) = self.spawn_oneshot(cx) else {
|
let Some(task) = self.spawn_oneshot(cx) else {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue