aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorWojciech Kępka2021-06-08 06:44:26 +0000
committerBlaž Hrastnik2021-06-08 08:23:38 +0000
commit4e3a3436025b7ae2677855de307f6016cb946509 (patch)
tree5d9667e2049c88924a3b3d678ea030ac20cd0c17 /helix-term/src
parent81e02e1ba405f9b43ffd0d0dd5a926df20cdafbf (diff)
Make `r<ENTER>` work
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/commands.rs18
1 files changed, 13 insertions, 5 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 52ffefbb..88bd481b 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -461,11 +461,19 @@ pub fn extend_first_nonwhitespace(cx: &mut Context) {
pub fn replace(cx: &mut Context) {
// need to wait for next key
cx.on_next_key(move |cx, event| {
- if let KeyEvent {
- code: KeyCode::Char(ch),
- ..
- } = event
- {
+ let ch = match event {
+ KeyEvent {
+ code: KeyCode::Char(ch),
+ ..
+ } => Some(ch),
+ KeyEvent {
+ code: KeyCode::Enter,
+ ..
+ } => Some('\n'),
+ _ => None,
+ };
+
+ if let Some(ch) = ch {
let (view, doc) = cx.current();
let transaction =