aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2018-07-04 18:48:43 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2018-07-04 18:48:43 +0530
commitcd318db1b22848249c3a41a884945108a72a4e8b (patch)
treee9c01d477e5b69d231618815aaffde022b999d1b
parent9a7660fb626d75465f85598b26baab641a34ca26 (diff)
downloadnnn-cd318db1b22848249c3a41a884945108a72a4e8b.tar.gz
Handle '\b' at prompt in earlier curses (rhel25)
-rw-r--r--nnn.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/nnn.c b/nnn.c
index c235e74..b136699 100644
--- a/nnn.c
+++ b/nnn.c
@@ -1083,7 +1083,7 @@ filterentries(char *path)
printprompt(ln);
while ((r = get_wch(ch)) != ERR) {
- if (*ch == 127 /* handle DEL */ || *ch == KEY_DC || *ch == KEY_BACKSPACE) {
+ if (*ch == 127 /* handle DEL */ || *ch == KEY_DC || *ch == KEY_BACKSPACE || *ch == '\b') {
if (len == 1) {
cur = oldcur;
*ch = CONTROL('L');
@@ -1216,6 +1216,14 @@ xreadline(char *fname, char *prompt)
if (*ch == KEY_ENTER || *ch == '\n' || *ch == '\r')
break;
+ if (*ch == '\b') {
+ if (pos > 0) {
+ memmove(buf + pos - 1, buf + pos, (len - pos) << 2);
+ --len, --pos;
+ }
+ continue;
+ }
+
if (*ch == CONTROL('L')) {
clearprompt();
printprompt(prompt);
@@ -2408,7 +2416,7 @@ browse(char *ipath, char *ifilter)
static char oldname[NAME_MAX + 1] __attribute__ ((aligned));
char *dir, *tmp, *run = NULL, *env = NULL;
struct stat sb;
- int r, fd, presel, ncp, copystartid = 0, copyendid = 0;
+ int r, fd, presel, ncp = 0, copystartid = 0, copyendid = 0;
enum action sel = SEL_RUNARG + 1;
bool dir_changed = FALSE;