Skip to content

Commit beaf590

Browse files
vanzueCopilot
andauthored
Remove IT badge from slash commands (#850)
Keep provider badges only for slash commands advertised by the active ACP agent. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 60b331e commit beaf590

1 file changed

Lines changed: 20 additions & 17 deletions

File tree

tools/wta/src/ui/command_popup.rs

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,11 @@ pub fn render_popup(frame: &mut Frame, state: PopupState<'_>, input_area: Rect)
8989
let agent_label = truncate_source_label(state.agent_label);
9090
let source_width = candidates
9191
.iter()
92-
.map(|candidate| match candidate {
93-
CommandCandidate::Client(_) => UnicodeWidthStr::width("IT"),
94-
CommandCandidate::Agent(_) => UnicodeWidthStr::width(agent_label.as_str()),
92+
.filter_map(|candidate| match candidate {
93+
CommandCandidate::Client(_) => None,
94+
CommandCandidate::Agent(_) => {
95+
Some(UnicodeWidthStr::width(agent_label.as_str()))
96+
}
9597
})
9698
.max()
9799
.unwrap_or_default();
@@ -105,7 +107,7 @@ pub fn render_popup(frame: &mut Frame, state: PopupState<'_>, input_area: Rect)
105107
}
106108
};
107109
let mut spans = command_name_spans(name, state.command_query);
108-
spans.push(source_badge_span(
110+
spans.extend(source_badge_span(
109111
candidate,
110112
agent_label.as_str(),
111113
source_width,
@@ -163,13 +165,17 @@ fn source_badge_span(
163165
candidate: &CommandCandidate<'_>,
164166
agent_label: &str,
165167
column_width: usize,
166-
) -> Span<'static> {
167-
let label = match candidate {
168-
CommandCandidate::Client(_) => "IT",
169-
CommandCandidate::Agent(_) => agent_label,
170-
};
171-
let padding = column_width.saturating_sub(UnicodeWidthStr::width(label));
172-
Span::styled(format!("[{label}]{} ", " ".repeat(padding)), theme::DIM)
168+
) -> Option<Span<'static>> {
169+
match candidate {
170+
CommandCandidate::Client(_) => None,
171+
CommandCandidate::Agent(_) => {
172+
let padding = column_width.saturating_sub(UnicodeWidthStr::width(agent_label));
173+
Some(Span::styled(
174+
format!("[{agent_label}]{} ", " ".repeat(padding)),
175+
theme::DIM,
176+
))
177+
}
178+
}
173179
}
174180

175181
fn truncate_source_label(label: &str) -> String {
@@ -324,7 +330,7 @@ mod tests {
324330
}
325331

326332
#[test]
327-
fn source_badges_distinguish_client_and_agent_commands() {
333+
fn source_badges_only_identify_agent_commands() {
328334
let client = CommandCandidate::Client(spec("model"));
329335
let agent_command = AcpSessionCommand {
330336
name: "usage".into(),
@@ -334,12 +340,9 @@ mod tests {
334340
};
335341
let agent = CommandCandidate::Agent(&agent_command);
336342

343+
assert!(source_badge_span(&client, "Copilot", 7).is_none());
337344
assert_eq!(
338-
source_badge_span(&client, "Copilot", 7).content,
339-
"[IT] "
340-
);
341-
assert_eq!(
342-
source_badge_span(&agent, "Copilot", 7).content,
345+
source_badge_span(&agent, "Copilot", 7).unwrap().content,
343346
"[Copilot] "
344347
);
345348
}

0 commit comments

Comments
 (0)