Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Do not add empty tasks to inventory (#8180)

Thorsten Ball583d85cf66a3
diff --git a/crates/tasks_ui/src/modal.rs b/crates/tasks_ui/src/modal.rs
index af2b3813a1e..de5cc5d5968 100644
--- a/crates/tasks_ui/src/modal.rs
+++ b/crates/tasks_ui/src/modal.rs
@@ -180,16 +180,21 @@ impl PickerDelegate for TasksModalDelegate {
fn confirm(&mut self, secondary: bool, cx: &mut ViewContext<picker::Picker<Self>>) {
let current_match_index = self.selected_index();
- let Some(task) = secondary
- .then(|| self.spawn_oneshot(cx))
- .flatten()
- .or_else(|| {
- self.matches.get(current_match_index).map(|current_match| {
- let ix = current_match.candidate_id;
- self.candidates[ix].clone()
- })
+
+ let task = if secondary {
+ if !self.last_prompt.trim().is_empty() {
+ self.spawn_oneshot(cx)
+ } else {
+ None
+ }
+ } else {
+ self.matches.get(current_match_index).map(|current_match| {
+ let ix = current_match.candidate_id;
+ self.candidates[ix].clone()
})
- else {
+ };
+
+ let Some(task) = task else {
return;
};