summaryrefslogtreecommitdiff
path: root/alacritty_terminal
diff options
context:
space:
mode:
authorAleksey Kuznetsov <zummenix@gmail.com>2019-10-16 00:13:58 +0500
committerChristian Duerr <contact@christianduerr.com>2019-10-15 21:13:58 +0200
commit49380bffd24203f139dc32c7bdc9958e64d9dd4d (patch)
tree0d4bfb3cb7f66868983a6ed5a22695749502995f /alacritty_terminal
parent124e98e94e66d5790d4523adb9cd75f85a4691f4 (diff)
downloadalacritty-49380bffd24203f139dc32c7bdc9958e64d9dd4d.tar.gz
alacritty-49380bffd24203f139dc32c7bdc9958e64d9dd4d.zip
Add support for alternate scroll escape
Fixes #2727.
Diffstat (limited to 'alacritty_terminal')
-rw-r--r--alacritty_terminal/src/ansi.rs3
-rw-r--r--alacritty_terminal/src/config/scrolling.rs10
-rw-r--r--alacritty_terminal/src/term/mod.rs38
3 files changed, 31 insertions, 20 deletions
diff --git a/alacritty_terminal/src/ansi.rs b/alacritty_terminal/src/ansi.rs
index 493b02aa..d989b78e 100644
--- a/alacritty_terminal/src/ansi.rs
+++ b/alacritty_terminal/src/ansi.rs
@@ -408,6 +408,8 @@ pub enum Mode {
ReportFocusInOut = 1004,
/// ?1006
SgrMouse = 1006,
+ /// ?1007
+ AlternateScroll = 1007,
/// ?1049
SwapScreenAndSetRestoreCursor = 1049,
/// ?2004
@@ -438,6 +440,7 @@ impl Mode {
1003 => Mode::ReportAllMouseMotion,
1004 => Mode::ReportFocusInOut,
1006 => Mode::SgrMouse,
+ 1007 => Mode::AlternateScroll,
1049 => Mode::SwapScreenAndSetRestoreCursor,
2004 => Mode::BracketedPaste,
_ => {
diff --git a/alacritty_terminal/src/config/scrolling.rs b/alacritty_terminal/src/config/scrolling.rs
index 8471fcd7..1746266f 100644
--- a/alacritty_terminal/src/config/scrolling.rs
+++ b/alacritty_terminal/src/config/scrolling.rs
@@ -12,9 +12,11 @@ pub struct Scrolling {
#[serde(deserialize_with = "failure_default")]
multiplier: ScrollingMultiplier,
#[serde(deserialize_with = "failure_default")]
- faux_multiplier: ScrollingMultiplier,
- #[serde(deserialize_with = "failure_default")]
pub auto_scroll: bool,
+
+ // TODO: DEPRECATED
+ #[serde(deserialize_with = "failure_default")]
+ faux_multiplier: Option<ScrollingMultiplier>,
}
impl Scrolling {
@@ -26,8 +28,8 @@ impl Scrolling {
self.multiplier.0
}
- pub fn faux_multiplier(self) -> u8 {
- self.faux_multiplier.0
+ pub fn faux_multiplier(self) -> Option<u8> {
+ self.faux_multiplier.map(|sm| sm.0)
}
// Update the history size, used in ref tests
diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs
index 382b10a9..bc7235cb 100644
--- a/alacritty_terminal/src/term/mod.rs
+++ b/alacritty_terminal/src/term/mod.rs
@@ -457,28 +457,29 @@ pub mod mode {
bitflags! {
pub struct TermMode: u16 {
- const SHOW_CURSOR = 0b00_0000_0000_0001;
- const APP_CURSOR = 0b00_0000_0000_0010;
- const APP_KEYPAD = 0b00_0000_0000_0100;
- const MOUSE_REPORT_CLICK = 0b00_0000_0000_1000;
- const BRACKETED_PASTE = 0b00_0000_0001_0000;
- const SGR_MOUSE = 0b00_0000_0010_0000;
- const MOUSE_MOTION = 0b00_0000_0100_0000;
- const LINE_WRAP = 0b00_0000_1000_0000;
- const LINE_FEED_NEW_LINE = 0b00_0001_0000_0000;
- const ORIGIN = 0b00_0010_0000_0000;
- const INSERT = 0b00_0100_0000_0000;
- const FOCUS_IN_OUT = 0b00_1000_0000_0000;
- const ALT_SCREEN = 0b01_0000_0000_0000;
- const MOUSE_DRAG = 0b10_0000_0000_0000;
- const ANY = 0b11_1111_1111_1111;
+ const SHOW_CURSOR = 0b000_0000_0000_0001;
+ const APP_CURSOR = 0b000_0000_0000_0010;
+ const APP_KEYPAD = 0b000_0000_0000_0100;
+ const MOUSE_REPORT_CLICK = 0b000_0000_0000_1000;
+ const BRACKETED_PASTE = 0b000_0000_0001_0000;
+ const SGR_MOUSE = 0b000_0000_0010_0000;
+ const MOUSE_MOTION = 0b000_0000_0100_0000;
+ const LINE_WRAP = 0b000_0000_1000_0000;
+ const LINE_FEED_NEW_LINE = 0b000_0001_0000_0000;
+ const ORIGIN = 0b000_0010_0000_0000;
+ const INSERT = 0b000_0100_0000_0000;
+ const FOCUS_IN_OUT = 0b000_1000_0000_0000;
+ const ALT_SCREEN = 0b001_0000_0000_0000;
+ const MOUSE_DRAG = 0b010_0000_0000_0000;
+ const ALTERNATE_SCROLL = 0b100_0000_0000_0000;
+ const ANY = 0b111_1111_1111_1111;
const NONE = 0;
}
}
impl Default for TermMode {
fn default() -> TermMode {
- TermMode::SHOW_CURSOR | TermMode::LINE_WRAP
+ TermMode::SHOW_CURSOR | TermMode::LINE_WRAP | TermMode::ALTERNATE_SCROLL
}
}
}
@@ -913,6 +914,9 @@ impl<T> Term<T> {
}
}
self.visual_bell.update_config(config);
+ if let Some(0) = config.scrolling.faux_multiplier() {
+ self.mode.remove(TermMode::ALTERNATE_SCROLL);
+ }
self.default_cursor_style = config.cursor.style;
self.dynamic_title = config.dynamic_title();
self.auto_scroll = config.scrolling.auto_scroll;
@@ -2008,6 +2012,7 @@ impl<T: EventListener> ansi::Handler for Term<T> {
ansi::Mode::ReportFocusInOut => self.mode.insert(TermMode::FOCUS_IN_OUT),
ansi::Mode::BracketedPaste => self.mode.insert(TermMode::BRACKETED_PASTE),
ansi::Mode::SgrMouse => self.mode.insert(TermMode::SGR_MOUSE),
+ ansi::Mode::AlternateScroll => self.mode.insert(TermMode::ALTERNATE_SCROLL),
ansi::Mode::LineWrap => self.mode.insert(TermMode::LINE_WRAP),
ansi::Mode::LineFeedNewLine => self.mode.insert(TermMode::LINE_FEED_NEW_LINE),
ansi::Mode::Origin => self.mode.insert(TermMode::ORIGIN),
@@ -2048,6 +2053,7 @@ impl<T: EventListener> ansi::Handler for Term<T> {
ansi::Mode::ReportFocusInOut => self.mode.remove(TermMode::FOCUS_IN_OUT),
ansi::Mode::BracketedPaste => self.mode.remove(TermMode::BRACKETED_PASTE),
ansi::Mode::SgrMouse => self.mode.remove(TermMode::SGR_MOUSE),
+ ansi::Mode::AlternateScroll => self.mode.remove(TermMode::ALTERNATE_SCROLL),
ansi::Mode::LineWrap => self.mode.remove(TermMode::LINE_WRAP),
ansi::Mode::LineFeedNewLine => self.mode.remove(TermMode::LINE_FEED_NEW_LINE),
ansi::Mode::Origin => self.mode.remove(TermMode::ORIGIN),