summaryrefslogtreecommitdiff
path: root/alacritty_terminal/src/term/mod.rs
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2020-07-11 20:03:09 +0300
committerGitHub <noreply@github.com>2020-07-11 20:03:09 +0300
commit18cf806a27f06185b1ceb2d63f3b9bc2dd3dc80e (patch)
tree6609ca3aec4fe8da171de474a4a8e8d9b572f0e5 /alacritty_terminal/src/term/mod.rs
parent5f039cee49b9c817177c6feecc5e7d97fb0a57e1 (diff)
downloadalacritty-18cf806a27f06185b1ceb2d63f3b9bc2dd3dc80e.tar.gz
alacritty-18cf806a27f06185b1ceb2d63f3b9bc2dd3dc80e.zip
Remove gui dependencies from alacritty_terminal
This commit removes font dependency from alacritty_terminal, so it'll simplify the usage of alacritty_terminal as a library, since you won't link to system's libraries anymore. It also moves many alacritty related config options from it. Fixes #3393.
Diffstat (limited to 'alacritty_terminal/src/term/mod.rs')
-rw-r--r--alacritty_terminal/src/term/mod.rs32
1 files changed, 12 insertions, 20 deletions
diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs
index f3f22d47..5a59b55b 100644
--- a/alacritty_terminal/src/term/mod.rs
+++ b/alacritty_terminal/src/term/mod.rs
@@ -721,14 +721,8 @@ pub struct Term<T> {
/// Current title of the window.
title: Option<String>,
- /// Default title for resetting it.
- default_title: String,
-
- /// Whether to permit updating the terminal title.
- dynamic_title: bool,
-
/// Stack of saved window titles. When a title is popped from this stack, the `title` for the
- /// term is set, and the Glutin window's title attribute is changed through the event listener.
+ /// term is set.
title_stack: Vec<Option<String>>,
/// Current forwards and backwards buffer search regexes.
@@ -777,11 +771,9 @@ impl<T> Term<T> {
cursor_style: None,
default_cursor_style: config.cursor.style,
vi_mode_cursor_style: config.cursor.vi_mode_style,
- dynamic_title: config.dynamic_title(),
event_proxy,
is_focused: true,
title: None,
- default_title: config.window.title.clone(),
title_stack: Vec::new(),
selection: None,
regex_search: None,
@@ -808,14 +800,12 @@ impl<T> Term<T> {
self.default_cursor_style = config.cursor.style;
self.vi_mode_cursor_style = config.cursor.vi_mode_style;
- self.default_title = config.window.title.clone();
- self.dynamic_title = config.dynamic_title();
+ let title_event = match &self.title {
+ Some(title) => Event::Title(title.clone()),
+ None => Event::ResetTitle,
+ };
- if self.dynamic_title {
- self.set_title(self.title.clone());
- } else {
- self.event_proxy.send_event(Event::Title(self.default_title.clone()));
- }
+ self.event_proxy.send_event(title_event);
if self.mode.contains(TermMode::ALT_SCREEN) {
self.inactive_grid.update_history(config.scrolling.history() as usize);
@@ -2167,10 +2157,12 @@ impl<T: EventListener> Handler for Term<T> {
self.title = title.clone();
- if self.dynamic_title {
- let title = title.unwrap_or_else(|| self.default_title.clone());
- self.event_proxy.send_event(Event::Title(title));
- }
+ let title_event = match title {
+ Some(title) => Event::Title(title),
+ None => Event::ResetTitle,
+ };
+
+ self.event_proxy.send_event(title_event);
}
#[inline]