Skip to content

Commit

Permalink
Handle a bit more when simulating input
Browse files Browse the repository at this point in the history
This isn't great, but it adds tab/return/delete, which feels
like the bare minimum; we can implement more as future work.
  • Loading branch information
cmyr committed Mar 8, 2021
1 parent 649f63a commit 846d1d8
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions druid-shell/src/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,26 @@ pub fn simulate_input<H: WinHandler + ?Sized>(
input_handler.handle_action(Action::Move(movement));
}
}
KbKey::Backspace => {
input_handler.handle_action(Action::Delete(Movement::Grapheme(Direction::Upstream)));
}
KbKey::Enter => {
// I'm sorry windows, you'll get IME soon.
input_handler.handle_action(Action::InsertNewLine {
ignore_hotkey: false,
newline_type: '\n',
});
}
KbKey::Tab => {
let action = if event.mods.shift() {
Action::InsertBacktab
} else {
Action::InsertTab {
ignore_hotkey: false,
}
};
input_handler.handle_action(action);
}
_ => {
handler.release_input_lock(token);
return false;
Expand Down

0 comments on commit 846d1d8

Please sign in to comment.