aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2016-07-04 09:19:48 -0700
committerJoe Wilm <joe@jwilm.com>2016-07-04 09:19:48 -0700
commitf895c2da30ad6fc71ee66324846b4214b914d200 (patch)
treeb46bd7f9207ef23858d4278f5e57e86ed348e1bc /src
parentb0444f05d6bf49dfc2ab5f5a4d0dc712ac068d70 (diff)
downloadalacritty-f895c2da30ad6fc71ee66324846b4214b914d200.tar.gz
alacritty-f895c2da30ad6fc71ee66324846b4214b914d200.zip
Add support for application keypad mode
Nothing uses it yet, but it is tracked in the terminal state.
Diffstat (limited to 'src')
-rw-r--r--src/ansi.rs8
-rw-r--r--src/term.rs13
2 files changed, 21 insertions, 0 deletions
diff --git a/src/ansi.rs b/src/ansi.rs
index b229061e..255db888 100644
--- a/src/ansi.rs
+++ b/src/ansi.rs
@@ -353,6 +353,12 @@ pub trait Handler {
/// DECSTBM - Set the terminal scrolling region
fn set_scrolling_region(&mut self, Range<Line>) {}
+
+ /// DECKPAM - Set keypad to applications mode (ESCape instead of digits)
+ fn set_keypad_application_mode(&mut self) {}
+
+ /// DECKPNM - Set keypad to numeric mode (digits intead of ESCape seq)
+ fn unset_keypad_application_mode(&mut self) {}
}
impl Parser {
@@ -438,6 +444,8 @@ impl Parser {
'c' => sequence_complete!(reset_state),
'7' => sequence_complete!(save_cursor_position),
'8' => sequence_complete!(restore_cursor_position),
+ '=' => sequence_complete!(set_keypad_application_mode),
+ '>' => sequence_complete!(unset_keypad_application_mode),
'P' | '_' | '^' | ']' | 'k' | '(' => {
self.state = State::EscapeOther;
},
diff --git a/src/term.rs b/src/term.rs
index a6d591ee..5f5dbfc5 100644
--- a/src/term.rs
+++ b/src/term.rs
@@ -112,6 +112,7 @@ pub mod mode {
pub flags TermMode: u8 {
const SHOW_CURSOR = 0b00000001,
const APP_CURSOR = 0b00000010,
+ const APP_KEYPAD = 0b00000100,
const ANY = 0b11111111,
const NONE = 0b00000000,
}
@@ -736,4 +737,16 @@ impl ansi::Handler for Term {
debug_println!("set scroll region: {:?}", region);
self.scroll_region = region;
}
+
+ #[inline]
+ fn set_keypad_application_mode(&mut self) {
+ debug_println!("set mode::APP_KEYPAD");
+ self.mode.insert(mode::APP_KEYPAD);
+ }
+
+ #[inline]
+ fn unset_keypad_application_mode(&mut self) {
+ debug_println!("unset mode::APP_KEYPAD");
+ self.mode.remove(mode::APP_KEYPAD);
+ }
}