on master help sign in
Make `r<ENTER>` work
commit4e3a3436025b7ae2677855de307f6016cb946509 authorWojciech Kępka <wojtek.kepka@protonmail.com> dateTue 8 Jun 2021, 08:44 (5 years ago) parent81e02e1
1 file changed+13−5
helix-term/src/commands.rs+13−5
helix-term/src/commands.rs+13−5
@@ -461,11 +461,19 @@ pub fn extend_first_nonwhitespace(cx: &mut Context) {
461461pub fn replace(cx: &mut Context) {
462462 // need to wait for next key
463463 cx.on_next_key(move |cx, event| {
464− if let KeyEvent {
465− code: KeyCode::Char(ch),
466− ..
467− } = event
468− {
464+ let ch = match event {
465+ KeyEvent {
466+ code: KeyCode::Char(ch),
467+ ..
468+ } => Some(ch),
469+ KeyEvent {
470+ code: KeyCode::Enter,
471+ ..
472+ } => Some('\n'),
473+ _ => None,
474+ };
475+
476+ if let Some(ch) = ch {
469477 let (view, doc) = cx.current();
470478
471479 let transaction =