Decode arrow keys as sent by urxvt

Not sure if we want to support this indefinitely but appears to be free as
of today.
This commit is contained in:
Johannes Altmanninger 2024-04-03 19:34:43 +02:00
parent e8eb4822ce
commit 350598cb99

View file

@ -636,10 +636,7 @@ pub trait InputEventQueuer {
) -> Option<Key> {
let Some(next) = self.try_readb(buffer) else {
if !self.paste_is_buffering() {
return Some(Key {
modifiers: Modifiers::default(),
codepoint: key::Escape,
});
return Some(Key::from_raw(key::Escape));
}
return None;
};
@ -788,10 +785,10 @@ pub trait InputEventQueuer {
_ => return None,
}
}
b'A' => masked_key(key::Up, None),
b'B' => masked_key(key::Down, None),
b'C' => masked_key(key::Right, None),
b'D' => masked_key(key::Left, None),
b'A' | b'a' => masked_key(key::Up, None),
b'B' | b'b' => masked_key(key::Down, None),
b'C' | b'c' => masked_key(key::Right, None),
b'D' | b'd' => masked_key(key::Left, None),
b'E' => masked_key('5', None), // Numeric keypad
b'F' => masked_key(key::End, None), // PC/xterm style
b'H' => masked_key(key::Home, None), // PC/xterm style
@ -958,10 +955,10 @@ pub trait InputEventQueuer {
#[rustfmt::skip]
let key = match code {
b' ' => Key{modifiers, codepoint: key::Space},
b'A' => Key{modifiers, codepoint: key::Up},
b'B' => Key{modifiers, codepoint: key::Down},
b'C' => Key{modifiers, codepoint: key::Right},
b'D' => Key{modifiers, codepoint: key::Left},
b'A' | b'a' => Key{modifiers, codepoint: key::Up},
b'B' | b'b' => Key{modifiers, codepoint: key::Down},
b'C' | b'c' => Key{modifiers, codepoint: key::Right},
b'D' | b'd' => Key{modifiers, codepoint: key::Left},
b'F' => Key{modifiers, codepoint: key::End},
b'H' => Key{modifiers, codepoint: key::Home},
b'I' => Key{modifiers, codepoint: key::Tab},