Skip to content

Commit b8a3e8f

Browse files
committed
Activate selected agent on empty prefix
Once /agent shows completion candidates, route Enter directly to the highlighted agent while preserving the bare /agent picker. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b6dd7b04-d567-42e1-8866-257b10fa88a0
1 parent 9abf42a commit b8a3e8f

2 files changed

Lines changed: 5 additions & 10 deletions

File tree

tools/wta/src/app.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,11 @@ fn agent_command_on_enter(
4747
input: &str,
4848
selected: Option<&AvailableAgent>,
4949
) -> Option<ParsedCommand> {
50-
let prefix = commands::agent_id_prefix(input)?;
51-
let rest = if prefix.is_empty() {
52-
String::new()
53-
} else {
54-
selected?.id.clone()
55-
};
50+
commands::agent_id_prefix(input)?;
5651
Some(ParsedCommand {
5752
kind: CommandKind::Agent,
5853
spec: commands::lookup("agent").expect("/agent is registered"),
59-
rest,
54+
rest: selected?.id.clone(),
6055
})
6156
}
6257

tools/wta/src/slash_command_tests.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -432,9 +432,9 @@ fn agent_trailing_space_opens_completion_with_all_agents() {
432432
let command =
433433
agent_command_on_enter(&app.current_tab().input, highlighted).expect("agent command");
434434
assert_eq!(command.kind, CommandKind::Agent);
435-
assert!(
436-
command.rest.is_empty(),
437-
"Enter must dispatch bare /agent so cmd_agent opens the picker"
435+
assert_eq!(
436+
command.rest, "copilot",
437+
"Enter must dispatch the highlighted agent once the completion list is visible"
438438
);
439439
}
440440

0 commit comments

Comments
 (0)