diff options
author | Wesley Gahr <wesleyey0408@gmail.com> | 2017-12-24 19:24:28 +0100 |
---|---|---|
committer | Joe Wilm <jwilm@users.noreply.github.com> | 2017-12-24 10:24:28 -0800 |
commit | ed91eb365e8e24b0ef64351235ab3f8022a8e7b3 (patch) | |
tree | 75e36a347fd48595486ca2e059934aad55e14855 /src/term/mod.rs | |
parent | 4fb2109497daddcc2f2f855f23073a4aa699463a (diff) | |
download | alacritty-ed91eb365e8e24b0ef64351235ab3f8022a8e7b3.tar.gz alacritty-ed91eb365e8e24b0ef64351235ab3f8022a8e7b3.zip |
Adding dynamic_title property to configuration (#819)
This logic is applied in Term's ansi::Handler implementation
to avoid unnecessary allocations.
Diffstat (limited to 'src/term/mod.rs')
-rw-r--r-- | src/term/mod.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/term/mod.rs b/src/term/mod.rs index 571686c1..98e08e6c 100644 --- a/src/term/mod.rs +++ b/src/term/mod.rs @@ -703,6 +703,8 @@ pub struct Term { /// Default style for resetting the cursor default_cursor_style: CursorStyle, + + dynamic_title: bool, } /// Terminal size info @@ -806,6 +808,7 @@ impl Term { semantic_escape_chars: config.selection().semantic_escape_chars.clone(), cursor_style: None, default_cursor_style: config.cursor_style(), + dynamic_title: config.dynamic_title(), } } @@ -831,6 +834,7 @@ impl Term { } self.visual_bell.update_config(config); self.default_cursor_style = config.cursor_style(); + self.dynamic_title = config.dynamic_title(); } #[inline] @@ -1159,7 +1163,9 @@ impl ansi::Handler for Term { /// Set the window title #[inline] fn set_title(&mut self, title: &str) { - self.next_title = Some(title.to_owned()); + if self.dynamic_title { + self.next_title = Some(title.to_owned()); + } } /// A character to be displayed |