Fix backspace rendering and error handling.

Fixes the following issues:
- When in filter mode, hitting backspace on the first character renders
  the backspace character on the screen along with the first character
  instead of just the search prompt (i.e. '/').
  For example, hitting backspace 3 times on the search string 'abc'
  produces this sequence:
     /abc
     /ab
     /a
     /a^?
- Go to the 'end' label if matches() fails (via regcomp()) when hitting
  backspace.
This commit is contained in:
codeliveroil 2018-08-20 16:59:47 -07:00
parent 424abe15ca
commit f800cc14a8

9
nnn.c
View file

@ -1077,8 +1077,13 @@ filterentries(char *path)
wcstombs(ln, wln, REGEX_MAX);
ndents = total;
if (matches(pln) == -1)
continue;
char *tmppln = pln;
if (strcmp(pln, "") == 0) {
tmppln=".*"; //otherwise setfilter will fail for the empty string.
}
if (matches(tmppln) == -1) {
goto end;
}
redraw(path);
printprompt(ln);
continue;