diff --git a/crates/project/src/terminals.rs b/crates/project/src/terminals.rs index 812d8f19347bc8dad7142c542ee4c99a1449e23f..e19fadeeab6b47fb5d228b111f6a45bd282659e6 100644 --- a/crates/project/src/terminals.rs +++ b/crates/project/src/terminals.rs @@ -52,6 +52,7 @@ impl Project { ( Some(TaskState { id: spawn_task.id, + full_label: spawn_task.full_label, label: spawn_task.label, status: TaskStatus::Running, completion_rx, diff --git a/crates/task/src/lib.rs b/crates/task/src/lib.rs index fe09b235bd826ecb45b18bbc1e8c448c23b10d12..eb19ef15e3d75438340a22a9bc99a5b1b6239f58 100644 --- a/crates/task/src/lib.rs +++ b/crates/task/src/lib.rs @@ -25,6 +25,8 @@ pub struct TaskId(pub String); pub struct SpawnInTerminal { /// Id of the task to use when determining task tab affinity. pub id: TaskId, + /// Full unshortened form of `label` field. + pub full_label: String, /// Human readable name of the terminal tab. pub label: String, /// Executable command to spawn. diff --git a/crates/task/src/task_template.rs b/crates/task/src/task_template.rs index 3845121c73bad384fd2d4f2323ffe7abe6d6d7c1..258a3362e3bb2265e234d92dc851f0a437ba16aa 100644 --- a/crates/task/src/task_template.rs +++ b/crates/task/src/task_template.rs @@ -115,10 +115,11 @@ impl TaskTemplate { Some(ResolvedTask { id: id.clone(), original_task: self.clone(), - resolved_label: full_label, + resolved_label: full_label.clone(), resolved: Some(SpawnInTerminal { id, cwd, + full_label, label: shortened_label, command, args, diff --git a/crates/terminal/src/terminal.rs b/crates/terminal/src/terminal.rs index 49e2aaaf12bb3c1da705c3d30173d2aca8bf5d34..b5913f1c4d02aea45d75a375e9ce2c57c556bdda 100644 --- a/crates/terminal/src/terminal.rs +++ b/crates/terminal/src/terminal.rs @@ -288,6 +288,7 @@ impl Display for TerminalError { pub struct SpawnTask { pub id: TaskId, + pub full_label: String, pub label: String, pub command: String, pub args: Vec, @@ -594,6 +595,7 @@ pub struct Terminal { pub struct TaskState { pub id: TaskId, + pub full_label: String, pub label: String, pub status: TaskStatus, pub completion_rx: Receiver<()>, @@ -1363,7 +1365,7 @@ impl Terminal { if truncate { truncate_and_trailoff(&task_state.label, MAX_CHARS) } else { - task_state.label.clone() + task_state.full_label.clone() } } None => self diff --git a/crates/terminal_view/src/terminal_panel.rs b/crates/terminal_view/src/terminal_panel.rs index 3a25d690a5c2e5cf7a5f5cbb3c7f42d96c06434a..346afeda8614a6a9bf75e80e4a4c62f378b89868 100644 --- a/crates/terminal_view/src/terminal_panel.rs +++ b/crates/terminal_view/src/terminal_panel.rs @@ -296,9 +296,10 @@ impl TerminalPanel { }) } - pub fn spawn_task(&mut self, spawn_in_terminal: &SpawnInTerminal, cx: &mut ViewContext) { + fn spawn_task(&mut self, spawn_in_terminal: &SpawnInTerminal, cx: &mut ViewContext) { let mut spawn_task = SpawnTask { id: spawn_in_terminal.id.clone(), + full_label: spawn_in_terminal.full_label.clone(), label: spawn_in_terminal.label.clone(), command: spawn_in_terminal.command.clone(), args: spawn_in_terminal.args.clone(), @@ -334,7 +335,7 @@ impl TerminalPanel { return; } - let terminals_for_task = self.terminals_for_task(&spawn_in_terminal.label, cx); + let terminals_for_task = self.terminals_for_task(&spawn_in_terminal.full_label, cx); if terminals_for_task.is_empty() { self.spawn_in_new_terminal(spawn_task, working_directory, cx); return; @@ -445,7 +446,7 @@ impl TerminalPanel { .filter_map(|(index, item)| Some((index, item.act_as::(cx)?))) .filter_map(|(index, terminal_view)| { let task_state = terminal_view.read(cx).terminal().read(cx).task()?; - if &task_state.label == label { + if &task_state.full_label == label { Some((index, terminal_view)) } else { None