When filtering and only having 1 result, noice will now open that file automatically. diff --git a/noice.c b/noice.c index 41df8d9..0037d8f 100644 --- a/noice.c +++ b/noice.c @@ -616,7 +616,7 @@ nochange: /* Cannot descend in empty directories */ if (ndents == 0) goto nochange; - +goin: mkpath(path, dents[cur].name, newpath, sizeof(newpath)); DPRINTF_S(newpath); @@ -666,12 +666,17 @@ nochange: if (tmp == NULL) tmp = ifilter; /* Check and report regex errors */ - r = setfilter(&re, tmp); - if (r != 0) + r = populate(path, oldpath, tmp); + if (r != 0) { + warn("populate"); goto nochange; + } freefilter(&re); strlcpy(fltr, tmp, sizeof(fltr)); DPRINTF_S(fltr); + /* goin on 1 result */ + if (ndents == 1) + goto goin; /* Save current */ if (ndents > 0) mkpath(path, dents[cur].name, oldpath, sizeof(oldpath));