Add support for application keypad mode
Nothing uses it yet, but it is tracked in the terminal state.
This commit is contained in:
parent
b0444f05d6
commit
f895c2da30
|
@ -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;
|
||||
},
|
||||
|
|
13
src/term.rs
13
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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue