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
2 changed files with 16 additions and 6 deletions

View File

@@ -738,10 +738,12 @@ fn decorate_title_context(
fn compute_title_context(
title_override: Option<String>,
thread_name: Option<String>,
task_running: bool,
tick: u128,
) -> Option<String> {
let context = title_override
.or(thread_name)
.as_deref()
.map(str::trim)
.filter(|name| !name.is_empty())
@@ -1790,6 +1792,7 @@ impl App {
let task_running = app.chat_widget.is_task_running();
let title_context = compute_title_context(
app.chat_widget.title_override(),
app.chat_widget.thread_name(),
task_running,
title_animation_tick(),
);
@@ -1900,6 +1903,7 @@ impl App {
let task_running = app.chat_widget.is_task_running();
let title_context = compute_title_context(
app.chat_widget.title_override(),
app.chat_widget.thread_name(),
task_running,
title_animation_tick(),
);
@@ -3821,14 +3825,22 @@ mod tests {
}
#[test]
fn title_context_defaults_to_none_without_manual_title() {
assert_eq!(compute_title_context(None, false, 0), None);
fn title_context_uses_thread_name_when_idle() {
assert_eq!(
compute_title_context(None, Some("named thread".to_string()), false, 0),
Some("named thread".to_string())
);
}
#[test]
fn title_context_prefers_manual_title_when_idle() {
assert_eq!(
compute_title_context(Some("manual title".to_string()), false, 0),
compute_title_context(
Some("manual title".to_string()),
Some("named thread".to_string()),
false,
0,
),
Some("manual title".to_string())
);
}

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(),
}