Skip to content

Commit

Permalink
Add support for cursor keys events in application mode (^[Ox) (#681)
Browse files Browse the repository at this point in the history
  • Loading branch information
awahlig authored Jul 2, 2022
1 parent 0a435e6 commit fe37c89
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/event/sys/unix/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ pub(crate) fn parse_event(buffer: &[u8], input_available: bool) -> Result<Option
Ok(None)
} else {
match buffer[2] {
b'D' => Ok(Some(InternalEvent::Event(Event::Key(KeyCode::Left.into())))),
b'C' => Ok(Some(InternalEvent::Event(Event::Key(KeyCode::Right.into())))),
b'A' => Ok(Some(InternalEvent::Event(Event::Key(KeyCode::Up.into())))),
b'B' => Ok(Some(InternalEvent::Event(Event::Key(KeyCode::Down.into())))),
b'H' => Ok(Some(InternalEvent::Event(Event::Key(KeyCode::Home.into())))),
b'F' => Ok(Some(InternalEvent::Event(Event::Key(KeyCode::End.into())))),
// F1-F4
val @ b'P'..=b'S' => Ok(Some(InternalEvent::Event(Event::Key(
KeyCode::F(1 + val - b'P').into(),
Expand Down

0 comments on commit fe37c89

Please sign in to comment.