summaryrefslogtreecommitdiff
path: root/src/term/mod.rs
diff options
context:
space:
mode:
authorDavid Hewitt <1939362+davidhewitt@users.noreply.github.com>2019-03-07 20:37:11 +0000
committerChristian Duerr <chrisduerr@users.noreply.github.com>2019-03-07 20:37:11 +0000
commitea87c1546b98265332239ccf6ff7eb45d7549ee2 (patch)
tree9b8cb69559008ddb5110f57e9c03ad52077d4e3b /src/term/mod.rs
parent9ba7c4fae4d927e109c7981f7e11ca7acdc14eb3 (diff)
downloadalacritty-ea87c1546b98265332239ccf6ff7eb45d7549ee2.tar.gz
alacritty-ea87c1546b98265332239ccf6ff7eb45d7549ee2.zip
Add dynamic title support for Window
Diffstat (limited to 'src/term/mod.rs')
-rw-r--r--src/term/mod.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/term/mod.rs b/src/term/mod.rs
index 30a1a214..63b0ca80 100644
--- a/src/term/mod.rs
+++ b/src/term/mod.rs
@@ -786,6 +786,7 @@ pub struct Term {
/// Default style for resetting the cursor
default_cursor_style: CursorStyle,
+ /// Whether to permit updating the terminal title
dynamic_title: bool,
/// Number of spaces in one tab
@@ -1357,6 +1358,19 @@ impl ansi::Handler for Term {
fn set_title(&mut self, title: &str) {
if self.dynamic_title {
self.next_title = Some(title.to_owned());
+
+ #[cfg(windows)]
+ {
+ // cmd.exe in winpty: winpty incorrectly sets the title to ' ' instead of
+ // 'Alacritty' - thus we have to substitute this back to get equivalent
+ // behaviour as conpty.
+ //
+ // The starts_with check is necessary because other shells e.g. bash set a
+ // different title and don't need Alacritty prepended.
+ if !tty::is_conpty() && title.starts_with(' ') {
+ self.next_title = Some(format!("Alacritty {}", title.trim()));
+ }
+ }
}
}