Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

Return whether or not editor key event was handled #187

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/interfaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,22 +250,24 @@ pub extern "C" fn dispatch(
Ok(OpCode::EditorKeyDown) => {
if let Some(ref mut editor) = get_editor() {
if let Ok(key) = Key::try_from(value) {
editor.key_down(KeyCode {
let handled = editor.key_down(KeyCode {
character: index as u8 as char,
key,
modifier: opt.to_bits() as u8,
});
return handled.into();
}
}
}
Ok(OpCode::EditorKeyUp) => {
if let Some(ref mut editor) = get_editor() {
if let Ok(key) = Key::try_from(value) {
editor.key_up(KeyCode {
let handled = editor.key_up(KeyCode {
character: index as u8 as char,
key,
modifier: opt.to_bits() as u8,
});
return handled.into();
}
}
}
Expand Down