diff options
author | Christian Duerr <chrisduerr@users.noreply.github.com> | 2018-01-06 00:50:12 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-06 00:50:12 +0000 |
commit | 650b5a0cbaccc6de2b53240372c2be79739d5d12 (patch) | |
tree | b3b0e712370fdd849c843b36f24cb5aed24f4aaa /src/term/mod.rs | |
parent | 228400a6c24bf651ecd74996d1fa68c3d92c9ff9 (diff) | |
download | alacritty-650b5a0cbaccc6de2b53240372c2be79739d5d12.tar.gz alacritty-650b5a0cbaccc6de2b53240372c2be79739d5d12.zip |
Improve ability of alacritty to deal with broken config
Until now alacritty completely refuses to start when the config is broken
in any way. This behavior has been changed so the worst-case is always
that alacritty launches with the default configuration.
When part of the config is broken, alacritty shouldn't instantly try to
recover to the default config, but instead try to use defaults only for
the parts of the config which are broken. This has also been implemented
for most of the fields in the configuration. So it should be possible that
parts are broken, but the rest is still used for the configuration.
This fixes #954.
Diffstat (limited to 'src/term/mod.rs')
-rw-r--r-- | src/term/mod.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/term/mod.rs b/src/term/mod.rs index 7e6ff1e0..72c259f7 100644 --- a/src/term/mod.rs +++ b/src/term/mod.rs @@ -444,8 +444,6 @@ pub mod mode { pub use self::mode::TermMode; -pub const TAB_SPACES: usize = 8; - trait CharsetMapping { fn map(&self, c: char) -> char { c @@ -721,6 +719,9 @@ pub struct Term { default_cursor_style: CursorStyle, dynamic_title: bool, + + /// Number of spaces in one tab + tabspaces: usize, } /// Terminal size info @@ -798,8 +799,9 @@ impl Term { let grid = Grid::new(num_lines, num_cols, &template); + let tabspaces = config.tabspaces(); let tabs = IndexRange::from(Column(0)..grid.num_cols()) - .map(|i| (*i as usize) % TAB_SPACES == 0) + .map(|i| (*i as usize) % tabspaces == 0) .collect::<Vec<bool>>(); let alt = grid.clone(); @@ -832,6 +834,7 @@ impl Term { cursor_style: None, default_cursor_style: config.cursor_style(), dynamic_title: config.dynamic_title(), + tabspaces, } } @@ -1072,7 +1075,7 @@ impl Term { // Recreate tabs list self.tabs = IndexRange::from(Column(0)..self.grid.num_cols()) - .map(|i| (*i as usize) % TAB_SPACES == 0) + .map(|i| (*i as usize) % self.tabspaces == 0) .collect::<Vec<bool>>(); if num_lines > old_lines { |