summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2020-03-01 04:07:36 +0000
committerGitHub <noreply@github.com>2020-03-01 07:07:36 +0300
commit8c6422458299496f6fa2a6984c93bd05b55c1888 (patch)
tree20197a827cbe8b06bd9f6d45be102fc2d8821a3e
parentbea6ece3f6e4f116e9f0319b6d0002943f28e3b8 (diff)
downloadalacritty-8c6422458299496f6fa2a6984c93bd05b55c1888.tar.gz
alacritty-8c6422458299496f6fa2a6984c93bd05b55c1888.zip
Remove `tabspaces` config option
This completely removes the tabspaces option from the Alacritty configuration, due to frequent misuse of it. Based on some research, none of the terminal emulators support setting the value for tabspaces or read the terminfo to determine init_tabs value at startup. The tested terminal emulators were URxvt, XTerm, and Termite.
-rw-r--r--CHANGELOG.md1
-rw-r--r--alacritty.yml9
-rw-r--r--alacritty/src/config/mod.rs8
-rw-r--r--alacritty_terminal/src/config/mod.rs21
-rw-r--r--alacritty_terminal/src/term/mod.rs15
5 files changed, 20 insertions, 34 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f3e6ded1..06bc1cc9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -63,6 +63,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Removed
- Config option `auto_scroll`, which is now always disabled
+- Config option `tabspaces`, which is now fixed at `8`
## 0.4.1
diff --git a/alacritty.yml b/alacritty.yml
index b65b4f01..7ed4666b 100644
--- a/alacritty.yml
+++ b/alacritty.yml
@@ -87,15 +87,6 @@
# scrollback is enabled (history > 0).
#multiplier: 3
-# Spaces per Tab (changes require restart)
-#
-# This setting defines the width of a tab in cells.
-#
-# Some applications, like Emacs, rely on knowing about the width of a tab.
-# To prevent unexpected behavior in these applications, it's also required to
-# change the `it` value in terminfo when altering this setting.
-#tabspaces: 8
-
# Font configuration
#font:
# Normal (roman) font face
diff --git a/alacritty/src/config/mod.rs b/alacritty/src/config/mod.rs
index d7b702b9..2a598714 100644
--- a/alacritty/src/config/mod.rs
+++ b/alacritty/src/config/mod.rs
@@ -209,6 +209,14 @@ fn print_deprecation_warnings(config: &Config) {
safely removed from the config"
);
}
+
+ if config.tabspaces.is_some() {
+ warn!(
+ target: LOG_TARGET_CONFIG,
+ "Config tabspaces has been removed and is now always 8, it can be safely removed from \
+ the config"
+ );
+ }
}
#[cfg(test)]
diff --git a/alacritty_terminal/src/config/mod.rs b/alacritty_terminal/src/config/mod.rs
index fd049af0..da95391c 100644
--- a/alacritty_terminal/src/config/mod.rs
+++ b/alacritty_terminal/src/config/mod.rs
@@ -96,10 +96,6 @@ pub struct Config<T> {
#[serde(default, deserialize_with = "failure_default")]
live_config_reload: DefaultTrueBool,
- /// Number of spaces in one tab
- #[serde(default, deserialize_with = "failure_default")]
- tabspaces: Tabspaces,
-
/// How much scrolling history to keep
#[serde(default, deserialize_with = "failure_default")]
pub scrolling: Scrolling,
@@ -133,6 +129,10 @@ pub struct Config<T> {
#[serde(skip)]
pub hold: bool,
+ // TODO: REMOVED
+ #[serde(default, deserialize_with = "failure_default")]
+ pub tabspaces: Option<usize>,
+
// TODO: DEPRECATED
#[serde(default, deserialize_with = "failure_default")]
pub render_timer: Option<bool>,
@@ -143,10 +143,6 @@ pub struct Config<T> {
}
impl<T> Config<T> {
- pub fn tabspaces(&self) -> usize {
- self.tabspaces.0
- }
-
#[inline]
pub fn draw_bold_text_with_bright_colors(&self) -> bool {
self.draw_bold_text_with_bright_colors
@@ -328,15 +324,6 @@ impl<'a> Deserialize<'a> for Alpha {
}
#[derive(Deserialize, Copy, Clone, Debug, PartialEq, Eq)]
-struct Tabspaces(usize);
-
-impl Default for Tabspaces {
- fn default() -> Self {
- Tabspaces(8)
- }
-}
-
-#[derive(Deserialize, Copy, Clone, Debug, PartialEq, Eq)]
struct DefaultTrueBool(bool);
impl Default for DefaultTrueBool {
diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs
index f198c59b..d545d686 100644
--- a/alacritty_terminal/src/term/mod.rs
+++ b/alacritty_terminal/src/term/mod.rs
@@ -47,6 +47,9 @@ const BRACKET_PAIRS: [(char, char); 4] = [('(', ')'), ('[', ']'), ('{', '}'), ('
/// Max size of the window title stack.
const TITLE_STACK_MAX_DEPTH: usize = 4096;
+/// Default tab interval, corresponding to terminfo `it` value.
+const INITIAL_TABSTOPS: usize = 8;
+
/// A type that can expand a given point to a region
///
/// Usually this is implemented for some 2-D array type since
@@ -916,8 +919,7 @@ impl<T> Term<T> {
let grid = Grid::new(num_lines, num_cols, history_size, Cell::default());
let alt = Grid::new(num_lines, num_cols, 0 /* scroll history */, Cell::default());
- let tabspaces = config.tabspaces();
- let tabs = TabStops::new(grid.num_cols(), tabspaces);
+ let tabs = TabStops::new(grid.num_cols());
let scroll_region = Line(0)..grid.num_lines();
@@ -2154,16 +2156,14 @@ impl<T: EventListener> Handler for Term<T> {
struct TabStops {
tabs: Vec<bool>,
- tabspaces: usize,
}
impl TabStops {
#[inline]
- fn new(num_cols: Column, tabspaces: usize) -> TabStops {
+ fn new(num_cols: Column) -> TabStops {
TabStops {
- tabspaces,
tabs: IndexRange::from(Column(0)..num_cols)
- .map(|i| (*i as usize) % tabspaces == 0)
+ .map(|i| (*i as usize) % INITIAL_TABSTOPS == 0)
.collect::<Vec<bool>>(),
}
}
@@ -2179,10 +2179,9 @@ impl TabStops {
/// Increase tabstop capacity.
#[inline]
fn resize(&mut self, num_cols: Column) {
- let tabspaces = self.tabspaces;
let mut index = self.tabs.len();
self.tabs.resize_with(num_cols.0, || {
- let is_tabstop = index % tabspaces == 0;
+ let is_tabstop = index % INITIAL_TABSTOPS == 0;
index += 1;
is_tabstop
});