mirror of
https://github.com/alacritty/alacritty.git
synced 2024-11-25 14:05:41 -05:00
Scroll to bottom on character received
This commit is contained in:
parent
96da93efd6
commit
001b780dda
4 changed files with 14 additions and 0 deletions
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue