Add '\r' back for the KeyEvent::Enter (#239)

This commit is contained in:
Zrzka 2019-09-20 19:19:40 +02:00 committed by Timon
parent 4952cb33d9
commit 60cd12710a
3 changed files with 4 additions and 3 deletions

View File

@ -98,6 +98,7 @@ pub enum KeyEvent {
End, End,
PageUp, PageUp,
PageDown, PageDown,
Tab,
BackTab, BackTab,
Delete, Delete,
Insert, Insert,

View File

@ -266,8 +266,8 @@ where
None => InputEvent::Keyboard(KeyEvent::Esc), None => InputEvent::Keyboard(KeyEvent::Esc),
} }
} }
b'\n' => InputEvent::Keyboard(KeyEvent::Enter), b'\r' | b'\n' => InputEvent::Keyboard(KeyEvent::Enter),
b'\t' => InputEvent::Keyboard(KeyEvent::Char('\t')), b'\t' => InputEvent::Keyboard(KeyEvent::Tab),
b'\x7F' => InputEvent::Keyboard(KeyEvent::Backspace), b'\x7F' => InputEvent::Keyboard(KeyEvent::Backspace),
c @ b'\x01'..=b'\x1A' => { c @ b'\x01'..=b'\x1A' => {
InputEvent::Keyboard(KeyEvent::Ctrl((c as u8 - 0x1 + b'a') as char)) InputEvent::Keyboard(KeyEvent::Ctrl((c as u8 - 0x1 + b'a') as char))

View File

@ -397,7 +397,7 @@ fn parse_key_event_record(key_event: &KeyEventRecord) -> Option<KeyEvent> {
if character == '\t' { if character == '\t' {
Some(KeyEvent::BackTab) Some(KeyEvent::BackTab)
} else { } else {
Some(KeyEvent::Char(character)) Some(KeyEvent::Tab)
} }
} else { } else {
Some(KeyEvent::Char(character)) Some(KeyEvent::Char(character))