mirror of
https://github.com/herdrdev/herdr.git
synced 2026-09-22 00:01:06 +00:00
fix(windows): strip elevated terminal title decoration (#2632)
This commit is contained in:
@@ -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) {}
|
||||
|
||||
|
||||
@@ -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
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user