fix: terminal title (#4352)

This commit is contained in:
Aram Drevekenin 2025-08-07 11:35:04 +02:00 committed by GitHub
parent 6848c8b136
commit 1b547b228a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -67,17 +67,17 @@ pub fn adjust_to_size(s: &str, rows: usize, columns: usize) -> String {
}
pub fn make_terminal_title(pane_title: &str) -> String {
// if we receive a title, we display it, otherwise we display the session name
if pane_title.is_empty() {
format!(
"\u{1b}]0;Zellij {}\u{07}",
"\u{1b}]0;{}{}\u{07}",
get_session_name()
.map(|n| format!("({}) ", n))
.unwrap_or_default()
)
.map(|n| if pane_title.is_empty() {
format!("{}", n)
} else {
format!("\u{1b}]0;{}\u{07}", pane_title,)
}
format!("{} | ", n)
})
.unwrap_or_default(),
pane_title
)
}
// Colors