Handle '\b' at prompt in earlier curses (rhel25)

This commit is contained in:
Arun Prakash Jana 2018-07-04 18:48:43 +05:30
parent 9a7660fb62
commit cd318db1b2
No known key found for this signature in database
GPG key ID: A75979F35C080412

12
nnn.c
View file

@ -1083,7 +1083,7 @@ filterentries(char *path)
printprompt(ln); printprompt(ln);
while ((r = get_wch(ch)) != ERR) { 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) { if (len == 1) {
cur = oldcur; cur = oldcur;
*ch = CONTROL('L'); *ch = CONTROL('L');
@ -1216,6 +1216,14 @@ xreadline(char *fname, char *prompt)
if (*ch == KEY_ENTER || *ch == '\n' || *ch == '\r') if (*ch == KEY_ENTER || *ch == '\n' || *ch == '\r')
break; break;
if (*ch == '\b') {
if (pos > 0) {
memmove(buf + pos - 1, buf + pos, (len - pos) << 2);
--len, --pos;
}
continue;
}
if (*ch == CONTROL('L')) { if (*ch == CONTROL('L')) {
clearprompt(); clearprompt();
printprompt(prompt); printprompt(prompt);
@ -2408,7 +2416,7 @@ browse(char *ipath, char *ifilter)
static char oldname[NAME_MAX + 1] __attribute__ ((aligned)); static char oldname[NAME_MAX + 1] __attribute__ ((aligned));
char *dir, *tmp, *run = NULL, *env = NULL; char *dir, *tmp, *run = NULL, *env = NULL;
struct stat sb; 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; enum action sel = SEL_RUNARG + 1;
bool dir_changed = FALSE; bool dir_changed = FALSE;