Do not add empty tasks to inventory (#8180)
I ran into this when trying out which keybindings work and accidentally added empty tasks. They get then added to the task inventory and displayed in the picker. Release Notes: - Fixed empty tasks being added to the list of tasks when using `task: spawn` --------- Co-authored-by: Kirill <kirill@zed.dev>
This commit is contained in:
parent
36586b77ec
commit
583d85cf66
1 changed files with 14 additions and 9 deletions
|
@ -180,16 +180,21 @@ impl PickerDelegate for TasksModalDelegate {
|
||||||
|
|
||||||
fn confirm(&mut self, secondary: bool, cx: &mut ViewContext<picker::Picker<Self>>) {
|
fn confirm(&mut self, secondary: bool, cx: &mut ViewContext<picker::Picker<Self>>) {
|
||||||
let current_match_index = self.selected_index();
|
let current_match_index = self.selected_index();
|
||||||
let Some(task) = secondary
|
|
||||||
.then(|| self.spawn_oneshot(cx))
|
let task = if secondary {
|
||||||
.flatten()
|
if !self.last_prompt.trim().is_empty() {
|
||||||
.or_else(|| {
|
self.spawn_oneshot(cx)
|
||||||
self.matches.get(current_match_index).map(|current_match| {
|
} else {
|
||||||
let ix = current_match.candidate_id;
|
None
|
||||||
self.candidates[ix].clone()
|
}
|
||||||
})
|
} 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;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue