diff options
author | Blaž Hrastnik | 2020-09-13 02:32:37 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2020-09-13 02:32:37 +0000 |
commit | d466882d0432b7e9cf905041aa7a4f8d56047de0 (patch) | |
tree | 4f4a935feb4c4cf2a77cc3c6a2e4ad822d1a9825 /helix-term | |
parent | f098166571fd8fc2046d49355dffc0d2aad29e50 (diff) |
Abstract Transaction::change_by_selection, working del/backspace.
Diffstat (limited to 'helix-term')
-rw-r--r-- | helix-term/src/editor.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/helix-term/src/editor.rs b/helix-term/src/editor.rs index 8e5c0042..a6ee999c 100644 --- a/helix-term/src/editor.rs +++ b/helix-term/src/editor.rs @@ -259,7 +259,7 @@ impl Editor { } } - pub async fn print_events(&mut self) { + pub async fn event_loop(&mut self) { let mut reader = EventStream::new(); let keymap = keymap::default(); @@ -285,6 +285,14 @@ impl Editor { code: KeyCode::Esc, .. } => helix_core::commands::normal_mode(state, 1), KeyEvent { + code: KeyCode::Backspace, + .. + } => helix_core::commands::delete_char_backward(state, 1), + KeyEvent { + code: KeyCode::Delete, + .. + } => helix_core::commands::delete_char_forward(state, 1), + KeyEvent { code: KeyCode::Char(c), .. } => helix_core::commands::insert_char(state, c), @@ -320,7 +328,7 @@ impl Editor { execute!(stdout, terminal::EnterAlternateScreen)?; - self.print_events().await; + self.event_loop().await; // reset cursor shape write!(stdout, "\x1B[2 q"); |