summaryrefslogtreecommitdiff
path: root/src/term
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2018-03-23 01:01:55 +0100
committerJoe Wilm <joe@jwilm.com>2018-06-02 09:56:50 -0700
commit688cabefc0bfc3224189c10235668eae5e5b0101 (patch)
tree7579612ed4a2d22e897918f6f678bce272745109 /src/term
parent4333b2fb1992b8185dc7041d9d3df8eee86717bc (diff)
downloadalacritty-688cabefc0bfc3224189c10235668eae5e5b0101.tar.gz
alacritty-688cabefc0bfc3224189c10235668eae5e5b0101.zip
Rework auto-scrolling options
This changes two things, the first thing it does is that now whenever a keybinding sends an escape sequence, the viewport is automatically scrolled to the bottom. This is enabled by default and fixes #1187. The second thing is automatic scrolling when a command writes to the terminal. So when running a command like `sleep 3; ls -lah`, alacritty will scroll to the bottom once the output is sent, even if the viewport is currently not at the bottom of the scrollback. Because this can have an impact on performance, and is not enabled by default in terminals like iTerm or Termite (VTE), it is an opt-in setting in the config.
Diffstat (limited to 'src/term')
-rw-r--r--src/term/mod.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/term/mod.rs b/src/term/mod.rs
index 3c7ef87c..198f8cea 100644
--- a/src/term/mod.rs
+++ b/src/term/mod.rs
@@ -756,6 +756,9 @@ pub struct Term {
/// Number of spaces in one tab
tabspaces: usize,
+
+ /// Automatically scroll to bottom when new lines are added
+ auto_scroll: bool,
}
/// Terminal size info
@@ -879,6 +882,7 @@ impl Term {
default_cursor_style: config.cursor_style(),
dynamic_title: config.dynamic_title(),
tabspaces,
+ auto_scroll: config.scrolling().auto_scroll,
}
}
@@ -905,6 +909,7 @@ impl Term {
self.visual_bell.update_config(config);
self.default_cursor_style = config.cursor_style();
self.dynamic_title = config.dynamic_title();
+ self.auto_scroll = config.scrolling().auto_scroll;
}
#[inline]
@@ -1255,6 +1260,11 @@ impl ansi::Handler for Term {
/// A character to be displayed
#[inline]
fn input(&mut self, c: char) {
+ // If enabled, scroll to bottom when character is received
+ if self.auto_scroll {
+ self.scroll_display(Scroll::Bottom);
+ }
+
if self.input_needs_wrap {
if !self.mode.contains(mode::TermMode::LINE_WRAP) {
return;