diff options
author | Christian Duerr <contact@christianduerr.com> | 2017-12-16 15:46:28 +0100 |
---|---|---|
committer | Joe Wilm <jwilm@users.noreply.github.com> | 2017-12-22 14:00:17 -0800 |
commit | e0993587e7c994214aef83a6d50e70959ee05d96 (patch) | |
tree | eb72c7ba329110bc87a4e471619fd9a54d7102a6 /src/term/mod.rs | |
parent | 41296a555e8df05bb2c83d3356abf0a8d1e5632f (diff) | |
download | alacritty-e0993587e7c994214aef83a6d50e70959ee05d96.tar.gz alacritty-e0993587e7c994214aef83a6d50e70959ee05d96.zip |
Implement faux scrolling
This patch implements faux scrolling inside the alternate screen buffer.
Whenever the user scrolls up or down while the alternate screen buffer
is active, instead of actual scrolling three up/down arrow keys are
inserted.
Diffstat (limited to 'src/term/mod.rs')
-rw-r--r-- | src/term/mod.rs | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/term/mod.rs b/src/term/mod.rs index 6bce8451..c5933236 100644 --- a/src/term/mod.rs +++ b/src/term/mod.rs @@ -416,19 +416,20 @@ impl<'a> Iterator for RenderableCellsIter<'a> { pub mod mode { bitflags! { pub struct TermMode: u16 { - const SHOW_CURSOR = 0b000000000001; - const APP_CURSOR = 0b000000000010; - const APP_KEYPAD = 0b000000000100; - const MOUSE_REPORT_CLICK = 0b000000001000; - const BRACKETED_PASTE = 0b000000010000; - const SGR_MOUSE = 0b000000100000; - const MOUSE_MOTION = 0b000001000000; - const LINE_WRAP = 0b000010000000; - const LINE_FEED_NEW_LINE = 0b000100000000; - const ORIGIN = 0b001000000000; - const INSERT = 0b010000000000; - const FOCUS_IN_OUT = 0b100000000000; - const ANY = 0b111111111111; + const SHOW_CURSOR = 0b0000000000001; + const APP_CURSOR = 0b0000000000010; + const APP_KEYPAD = 0b0000000000100; + const MOUSE_REPORT_CLICK = 0b0000000001000; + const BRACKETED_PASTE = 0b0000000010000; + const SGR_MOUSE = 0b0000000100000; + const MOUSE_MOTION = 0b0000001000000; + const LINE_WRAP = 0b0000010000000; + const LINE_FEED_NEW_LINE = 0b0000100000000; + const ORIGIN = 0b0001000000000; + const INSERT = 0b0010000000000; + const FOCUS_IN_OUT = 0b0100000000000; + const ALT_SCREEN_BUF = 0b1000000000000; + const ANY = 0b1111111111111; const NONE = 0; } } @@ -1789,6 +1790,7 @@ impl ansi::Handler for Term { trace!("set_mode: {:?}", mode); match mode { ansi::Mode::SwapScreenAndSetRestoreCursor => { + self.mode.insert(mode::ALT_SCREEN_BUF); self.save_cursor_position(); if !self.alt { self.swap_alt(); @@ -1818,6 +1820,7 @@ impl ansi::Handler for Term { trace!("unset_mode: {:?}", mode); match mode { ansi::Mode::SwapScreenAndSetRestoreCursor => { + self.mode.remove(mode::ALT_SCREEN_BUF); self.restore_cursor_position(); if self.alt { self.swap_alt(); |