fix(windows): strip elevated terminal title decoration (#2632)

This commit is contained in:
JJ Liebig
2026-08-10 21:49:41 +03:00
committed by GitHub
parent 7e4ab7b034
commit 1ac44afcc0
3 changed files with 25 additions and 1 deletions
+5
View File
@@ -39,6 +39,11 @@ pub(crate) fn apply_pane_runtime_marker(command: &mut portable_pty::CommandBuild
apply_pane_runtime_marker_platform(command);
}
#[cfg(not(windows))]
pub(crate) fn terminal_title_for_presentation(title: &str) -> &str {
title
}
#[cfg(not(windows))]
fn apply_pane_runtime_marker_platform(_command: &mut portable_pty::CommandBuilder) {}
+5
View File
@@ -82,6 +82,11 @@ use super::{ClipboardImage, ForegroundJob, Signal};
const STILL_ACTIVE: u32 = 259;
const FOREGROUND_PROCESS_SNAPSHOT_CACHE_TTL: Duration = Duration::from_millis(250);
const PANE_RUNTIME_MARKER_ENV_VAR: &str = "HERDR_PANE_RUNTIME_ID";
pub(crate) fn terminal_title_for_presentation(title: &str) -> &str {
title.strip_prefix("Administrator: ").unwrap_or(title)
}
const MAX_PROCESS_ENVIRONMENT_BYTES: usize = 256 * 1024;
const PROCESS_ENVIRONMENT_READ_CHUNK_BYTES: usize = 16 * 1024;
const PROCESS_RUNTIME_MARKER_CACHE_CAPACITY: usize = 1_024;
+15 -1
View File
@@ -1,7 +1,7 @@
const CLAUDE_ACTIVITY_GLYPHS: &str = "·✢✳✶✻✽";
pub(crate) fn stripped_terminal_title(title: &str) -> Option<String> {
let title = title.trim();
let title = crate::platform::terminal_title_for_presentation(title).trim();
if title.is_empty() {
return None;
}
@@ -61,4 +61,18 @@ mod tests {
assert_eq!(stripped_terminal_title(" "), None);
assert_eq!(stripped_terminal_title(""), None);
}
#[cfg(windows)]
#[test]
fn strips_one_windows_elevation_decoration_before_activity_glyph() {
assert_eq!(
stripped_terminal_title("Administrator: ⠋ task").as_deref(),
Some("task")
);
assert_eq!(
stripped_terminal_title("Administrator: Administrator: task").as_deref(),
Some("Administrator: task")
);
assert_eq!(stripped_terminal_title("Administrator: "), None);
}
}