Add '\r' back for the KeyEvent::Enter (#239)
This commit is contained in:
parent
4952cb33d9
commit
60cd12710a
@ -98,6 +98,7 @@ pub enum KeyEvent {
|
|||||||
End,
|
End,
|
||||||
PageUp,
|
PageUp,
|
||||||
PageDown,
|
PageDown,
|
||||||
|
Tab,
|
||||||
BackTab,
|
BackTab,
|
||||||
Delete,
|
Delete,
|
||||||
Insert,
|
Insert,
|
||||||
|
@ -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))
|
||||||
|
@ -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))
|
||||||
|
Loading…
Reference in New Issue
Block a user