Disable partial regex errors

This commit is contained in:
Arun Prakash Jana 2019-12-10 18:25:00 +05:30
parent e8183058fd
commit 8d143bb87f
No known key found for this signature in database
GPG key ID: A75979F35C080412
3 changed files with 6 additions and 9 deletions

View file

@ -46,7 +46,7 @@ Add to that an awesome [Wiki](https://github.com/jarun/nnn/wiki)!
- By file name, modification/access time, size, extension - By file name, modification/access time, size, extension
- Search - Search
- Instant filtering with *search-as-you-type* - Instant filtering with *search-as-you-type*
- Regex and substring match - Regex (default) and substring match
- Subtree search to open or edit files (using plugin) - Subtree search to open or edit files (using plugin)
- Mimes - Mimes
- Open with desktop opener or specify a custom app - Open with desktop opener or specify a custom app

2
nnn.1
View file

@ -141,7 +141,7 @@ Common use cases:
(1) To list all matches starting with the filter expression, start the expression (1) To list all matches starting with the filter expression, start the expression
with a '^' (caret) symbol. with a '^' (caret) symbol.
.br .br
(2) Type '^.*\\.mkv' to list all MKV files. (2) Type '\\.mkv' to list all MKV files.
.br .br
(3) Use '.*' to match any character (\fIsort of\fR fuzzy search). (3) Use '.*' to match any character (\fIsort of\fR fuzzy search).
.Pp .Pp

View file

@ -1801,12 +1801,7 @@ static char xchartohex(char c)
static int setfilter(regex_t *regex, const char *filter) static int setfilter(regex_t *regex, const char *filter)
{ {
int r = regcomp(regex, filter, REG_NOSUB | REG_EXTENDED | REG_ICASE); return regcomp(regex, filter, REG_NOSUB | REG_EXTENDED | REG_ICASE);
if (r != 0 && filter && filter[0] != '\0')
mvprintw(xlines - 1, 0, "regex error: %d\n", r);
return r;
} }
static int visible_re(const fltrexp_t *fltrexp, const char *fname) static int visible_re(const fltrexp_t *fltrexp, const char *fname)
@ -2131,8 +2126,10 @@ static int filterentries(char *path)
*/ */
/* ndents = total; */ /* ndents = total; */
if (matches(pln) == -1) if (matches(pln) == -1) {
printprompt(ln);
continue; continue;
}
/* If the only match is a dir, auto-select and cd into it */ /* If the only match is a dir, auto-select and cd into it */
if (ndents == 1 && cfg.filtermode if (ndents == 1 && cfg.filtermode