Handle paste events in editor

Only on non-windows platforms though, since crossterm doesn't support
pasting on windows.
This commit is contained in:
Joscha 2022-08-10 23:59:40 +02:00
parent 5ad9f0f3e7
commit f7e7003788
3 changed files with 15 additions and 2 deletions

View file

@ -78,6 +78,7 @@ pub fn handle_editor_event(
// Editing
key!(Char ch) if char_filter(*ch) => editor.insert_char(terminal.frame(), *ch),
key!(Paste str) if str.chars().all(char_filter) => editor.insert_str(terminal.frame(), str),
key!(Ctrl + 'h') | key!(Backspace) => editor.backspace(terminal.frame()),
key!(Ctrl + 'd') | key!(Delete) => editor.delete(),
key!(Ctrl + 'l') => editor.clear(),