From d466882d0432b7e9cf905041aa7a4f8d56047de0 Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Sun, 13 Sep 2020 11:32:37 +0900 Subject: Abstract Transaction::change_by_selection, working del/backspace. --- helix-term/src/editor.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'helix-term/src') 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(); @@ -284,6 +284,14 @@ impl Editor { KeyEvent { 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), .. @@ -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"); -- cgit v1.2.3-70-g09d2