From 34c3d2116a38f8e1fe993e9b4c11cc3d2bd28b94 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Mon, 26 Apr 2021 00:29:35 +0530 Subject: [PATCH] Bksp/Del at empty filter prompt to refresh dir and retain prompt --- nnn.1 | 2 ++ src/nnn.c | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/nnn.1 b/nnn.1 index bab27e79..8c06a1cf 100644 --- a/nnn.1 +++ b/nnn.1 @@ -214,6 +214,8 @@ Special keys at \fBempty filter prompt\fR: : | Toggle case-sensitivity ^L | Clear filter (\fIif prompt is non-empty\fR) | OR apply last filter + Bksp | Stay at filter prompt and refresh dir + Del | Stay at filter prompt and refresh dir ------ + --------------------------------------- .Ed .Pp diff --git a/src/nnn.c b/src/nnn.c index 5928b4ba..ddff97e0 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -2857,8 +2857,10 @@ static int filterentries(char *path, char *lastname) wln[--len] = '\0'; wcstombs(ln, wln, REGEX_MAX); ndents = total; - } else - continue; + } else { + *ch = FILTER; + goto end; + } // fallthrough case CONTROL('L'): if (*ch == CONTROL('L')) { @@ -6436,11 +6438,12 @@ nochange: } #endif presel = filterentries(path, lastname); - if (presel == ESC) { presel = 0; break; } + if (presel == FILTER) /* Refresh dir and filter again */ + goto begin; goto nochange; case SEL_MFLTR: // fallthrough case SEL_HIDDEN: // fallthrough