task: Make UseSelectedQuery modal action expand to full command (#9947)
Previously it expanded to a label, which was correct for oneshots, but wrong for everything else. Release Notes: - Improved UseSelectedQuery (shift-enter) action for tasks modal by making it substitute a full command and not the task label. - Fixed one-shot tasks having duplicates in tasks modal.
This commit is contained in:
parent
c7f04691d9
commit
1360dffead
4 changed files with 34 additions and 14 deletions
|
@ -66,9 +66,14 @@ impl OneshotSource {
|
|||
|
||||
/// Spawns a certain task based on the user prompt.
|
||||
pub fn spawn(&mut self, prompt: String) -> Arc<dyn Task> {
|
||||
let ret = Arc::new(OneshotTask::new(prompt));
|
||||
self.tasks.push(ret.clone());
|
||||
ret
|
||||
if let Some(task) = self.tasks.iter().find(|task| task.id().0 == prompt) {
|
||||
// If we already have an oneshot task with that command, let's just reuse it.
|
||||
task.clone()
|
||||
} else {
|
||||
let new_oneshot = Arc::new(OneshotTask::new(prompt));
|
||||
self.tasks.push(new_oneshot.clone());
|
||||
new_oneshot
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue