Compare commits

..

4 Commits

Author SHA1 Message Date
Omer Strulovich
7269a2ef40 Adjust terminal title spinner formatting and clearing
Co-authored-by: Codex <noreply@openai.com>
2026-03-04 16:30:44 -05:00
Omer Strulovich
95ca63a688 Load terminal title from thread name automatically
Co-authored-by: Codex <noreply@openai.com>
2026-03-04 15:50:50 -05:00
Omer Strulovich
67b7db7684 Add terminal title spinner while running
Co-authored-by: Codex <noreply@openai.com>
2026-03-04 15:50:43 -05:00
Omer Strulovich
d1e20cdcac Add /title terminal title override
Co-authored-by: Codex <noreply@openai.com>
2026-03-04 15:50:23 -05:00
4 changed files with 31 additions and 18 deletions

View File

@@ -3814,12 +3814,12 @@ mod tests {
#[test]
fn decorate_title_context_adds_spinner_while_running() {
assert_eq!(
decorate_title_context(Some("Named thread".to_string()), true, 0),
Some("⠋ - Named thread".to_string())
decorate_title_context(Some("Working".to_string()), true, 0),
Some("⠋ - Working".to_string())
);
assert_eq!(
decorate_title_context(Some("Named thread".to_string()), true, 9),
Some("⠏ - Named thread".to_string())
decorate_title_context(Some("Working".to_string()), true, 9),
Some("⠏ - Working".to_string())
);
assert_eq!(decorate_title_context(None, true, 0), Some("".to_string()));
}

View File

@@ -17,7 +17,11 @@ use std::collections::HashSet;
// Hide alias commands in the default popup list so each unique action appears once.
// `quit` is an alias of `exit`, so we skip `quit` here.
// `approvals` is an alias of `permissions`.
const ALIAS_COMMANDS: &[SlashCommand] = &[SlashCommand::Quit, SlashCommand::Approvals];
const ALIAS_COMMANDS: &[SlashCommand] = &[
SlashCommand::Quit,
SlashCommand::Approvals,
SlashCommand::Title,
];
/// A selectable item in the popup: either a built-in command or a user prompt.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
@@ -478,11 +482,11 @@ mod tests {
}
#[test]
fn title_shown_in_empty_filter_and_for_prefix() {
fn title_hidden_in_empty_filter_but_shown_for_prefix() {
let mut popup = CommandPopup::new(Vec::new(), CommandPopupFlags::default());
popup.on_composer_text_change("/".to_string());
let items = popup.filtered_items();
assert!(items.contains(&CommandItem::Builtin(SlashCommand::Title)));
assert!(!items.contains(&CommandItem::Builtin(SlashCommand::Title)));
popup.on_composer_text_change("/ti".to_string());
let items = popup.filtered_items();

View File

@@ -69,14 +69,25 @@ mod tests {
}
#[test]
fn known_commands_resolve_for_dispatch() {
for (name, expected) in [
("debug-config", SlashCommand::DebugConfig),
("clear", SlashCommand::Clear),
("title", SlashCommand::Title),
] {
assert_eq!(find_builtin_command(name, all_enabled_flags()), Some(expected));
}
fn debug_command_still_resolves_for_dispatch() {
let cmd = find_builtin_command("debug-config", all_enabled_flags());
assert_eq!(cmd, Some(SlashCommand::DebugConfig));
}
#[test]
fn clear_command_resolves_for_dispatch() {
assert_eq!(
find_builtin_command("clear", all_enabled_flags()),
Some(SlashCommand::Clear)
);
}
#[test]
fn title_command_resolves_for_dispatch() {
assert_eq!(
find_builtin_command("title", all_enabled_flags()),
Some(SlashCommand::Title)
);
}
#[test]

View File

@@ -80,9 +80,7 @@ fn format_terminal_title(context: Option<&str>) -> String {
.filter(|text| !text.is_empty());
match context {
Some(context) if has_spinner_prefix(&context) => {
format!("{DEFAULT_TERMINAL_TITLE} {context}")
}
Some(context) if has_spinner_prefix(&context) => format!("{DEFAULT_TERMINAL_TITLE} {context}"),
Some(context) => format!("{DEFAULT_TERMINAL_TITLE} - {context}"),
None => DEFAULT_TERMINAL_TITLE.to_string(),
}