aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2018-02-16 17:33:32 -0800
committerJoe Wilm <joe@jwilm.com>2018-03-07 09:47:21 -0800
commit001b780dda549b08c170193ea81b9961edb20acf (patch)
treeb0172ab3080f6eab9238222a5135d66cb082a53d
parent96da93efd63ff3cf7e9f02b6dd3086bc3f876de9 (diff)
downloadalacritty-001b780dda549b08c170193ea81b9961edb20acf.tar.gz
alacritty-001b780dda549b08c170193ea81b9961edb20acf.zip
Scroll to bottom on character received
-rw-r--r--src/event.rs4
-rw-r--r--src/grid/mod.rs4
-rw-r--r--src/input.rs2
-rw-r--r--src/term/mod.rs4
4 files changed, 14 insertions, 0 deletions
diff --git a/src/event.rs b/src/event.rs
index d0d9a8da..0c8a26f4 100644
--- a/src/event.rs
+++ b/src/event.rs
@@ -59,6 +59,10 @@ impl<'a, N: Notify + 'a> input::ActionContext for ActionContext<'a, N> {
self.terminal.scroll_display(count);
}
+ fn reset_scroll(&mut self) {
+ self.terminal.reset_scroll();
+ }
+
fn copy_selection(&self, buffer: ::copypasta::Buffer) {
if let Some(ref selection) = *self.selection {
selection.to_span(self.terminal)
diff --git a/src/grid/mod.rs b/src/grid/mod.rs
index 23ee9cf4..c6543270 100644
--- a/src/grid/mod.rs
+++ b/src/grid/mod.rs
@@ -108,6 +108,10 @@ impl<T: Copy + Clone> Grid<T> {
);
}
+ pub fn reset_scroll(&mut self) {
+ self.display_offset = 0;
+ }
+
pub fn new(lines: index::Line, cols: index::Column, template: T) -> Grid<T> {
let mut raw = Storage::with_capacity(*lines + SCROLLBACK_LINES, lines);
let template_row = Row::new(cols, &template);
diff --git a/src/input.rs b/src/input.rs
index 6ffdd507..987ce093 100644
--- a/src/input.rs
+++ b/src/input.rs
@@ -65,6 +65,7 @@ pub trait ActionContext {
fn change_font_size(&mut self, delta: i8);
fn reset_font_size(&mut self);
fn scroll(&mut self, count: isize) {}
+ fn reset_scroll(&mut self) {}
}
/// Describes a state and action to take in that state
@@ -514,6 +515,7 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> {
/// Process a received character
pub fn received_char(&mut self, c: char) {
if !*self.ctx.suppress_chars() {
+ self.ctx.reset_scroll();
self.ctx.clear_selection();
let utf8_len = c.len_utf8();
diff --git a/src/term/mod.rs b/src/term/mod.rs
index a523acaa..669ada2f 100644
--- a/src/term/mod.rs
+++ b/src/term/mod.rs
@@ -807,6 +807,10 @@ impl Term {
self.dirty = true;
}
+ pub fn reset_scroll(&mut self) {
+ self.grid.reset_scroll();
+ }
+
#[inline]
pub fn get_next_mouse_cursor(&mut self) -> Option<MouseCursor> {
self.next_mouse_cursor.take()