From 8447b76e1abf0958d06e747a544c5df726913848 Mon Sep 17 00:00:00 2001 From: sloumdrone Date: Sat, 4 Jan 2020 22:47:39 -0800 Subject: [PATCH] Adds r command to replace a char --- .gitignore | 1 + hermes.c | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/.gitignore b/.gitignore index 35a7c6e..58bef92 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ hermes *.txt test* +*.1.gz diff --git a/hermes.c b/hermes.c index 9a406ad..3888b72 100644 --- a/hermes.c +++ b/hermes.c @@ -1109,6 +1109,19 @@ void editorCommandKp(int c) { case '\033': if (E.mode == VisualMode) E.mode = CommandMode; break; + case 'r': + { + int c = editorReadKey(); + if (c) { + E.mode = InputMode; + editorMoveCursor(ARROW_RIGHT); + editorDeleteChar(); + editorInputKp(c); + E.mode = CommandMode; + editorMoveCursor(ARROW_LEFT); + } + } + break; case 'g': if (deleting) { int totlen = 0;