aboutsummaryrefslogtreecommitdiffstats
path: root/src/nnn.c
diff options
context:
space:
mode:
authorGravatar Ethan R <ethanr2048@gmail.com>2020-01-27 07:27:56 -0600
committerGravatar Mischievous Meerkat <engineerarun@gmail.com>2020-01-27 18:57:56 +0530
commit812368cce65d7a664379f8ca7403372c8ff28101 (patch)
treeb43d4f209484cc1282a698b1884a5e30b30bd28c /src/nnn.c
parent3fd9e6ace7ca8007893e73c37a6a52da2fcf0bff (diff)
downloadnnn-812368cce65d7a664379f8ca7403372c8ff28101.tar.gz
Added more readline bindings (#452)
Diffstat (limited to 'src/nnn.c')
-rw-r--r--src/nnn.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/nnn.c b/src/nnn.c
index 039d88c..5b1c7a8 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -2409,6 +2409,11 @@ static char *xreadline(const char *prefill, const char *prompt)
case '\n': // fallthrough
case '\r':
goto END;
+ case CONTROL('D'):
+ if (pos < len)
+ ++pos;
+ else
+ continue; // fallthrough
case 127: // fallthrough
case '\b': /* rhel25 sends '\b' for backspace */
if (pos > 0) {
@@ -2418,6 +2423,28 @@ static char *xreadline(const char *prefill, const char *prompt)
} // fallthrough
case '\t': /* TAB breaks cursor position, ignore it */
continue;
+ case CONTROL('F'):
+ if (pos < len)
+ ++pos;
+ continue;
+ case CONTROL('B'):
+ if (pos > 0)
+ --pos;
+ continue;
+ case CONTROL('W'):
+ printprompt(prompt);
+ do {
+ if (pos == 0)
+ break;
+ memmove(buf + pos - 1, buf + pos,
+ (len - pos) * WCHAR_T_WIDTH);
+ --pos, --len;
+ } while (buf[pos-1] != ' ' && buf[pos-1] != '/');
+ continue;
+ case CONTROL('K'):
+ printprompt(prompt);
+ len = pos;
+ continue;
case CONTROL('L'):
printprompt(prompt);
len = pos = 0;