Makefile | 5 +++++ misc/haiku/Makefile | 7 ++++++- src/nnn.c | 7 ++++++- diff --git a/Makefile b/Makefile index 485d1ad1562ba81c93b8b00f316d96001fe195dc..5a283e4d565a3cc49def64bfc2be18681fee83ce 100644 --- a/Makefile +++ b/Makefile @@ -26,6 +26,7 @@ O_BENCH := 0 # benchmark mode (stops at first user input) O_NOSSN := 0 # disable session support O_NOUG := 0 # disable user, group name in status bar O_NOX11 := 0 # disable X11 integration +O_MATCHFLTR := 0 # allow filters without matches # User patches O_GITSTATUS := 0 # add git status to detail view @@ -113,6 +114,10 @@ endif ifeq ($(strip $(O_NOX11)),1) CPPFLAGS += -DNOX11 +endif + +ifeq ($(strip $(O_MATCHFLTR)),1) + CPPFLAGS += -DMATCHFLTR endif ifeq ($(shell $(PKG_CONFIG) ncursesw && echo 1),1) diff --git a/misc/haiku/Makefile b/misc/haiku/Makefile index c4aabe14c9a0adc3612fa3f63cad45558f190f37..7a60a1cc4190ef7a97adb6399b10e282b8153daa 100644 --- a/misc/haiku/Makefile +++ b/misc/haiku/Makefile @@ -21,9 +21,10 @@ O_ICONS := 0 # support icons-in-terminal O_NERD := 0 # support icons-nerdfont O_QSORT := 0 # use Alexey Tourbin's QSORT implementation O_BENCH := 0 # benchmark mode (stops at first user input) -O_NOSSN := 0 # enable session support +O_NOSSN := 0 # disable session support O_NOUG := 0 # disable user, group name in status bar O_NOX11 := 0 # disable X11 integration +O_MATCHFLTR := 0 # allow filters without matches # User patches O_GITSTATUS := 0 # add git status to detail view @@ -116,6 +117,10 @@ endif ifeq ($(strip $(O_NOX11)),1) CPPFLAGS += -DNOX11 +endif + +ifeq ($(strip $(O_MATCHFLTR)),1) + CPPFLAGS += -DMATCHFLTR endif ifeq ($(shell $(PKG_CONFIG) ncursesw && echo 1),1) diff --git a/src/nnn.c b/src/nnn.c index 67a1dd4d43c8780c80ff545e65a2a9f22d375fb1..76a6f645db04e7fff4ca1a5829cbf2c22fc31f3b 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -3367,9 +3367,14 @@ /* Forward-filtering optimization: * - new matches can only be a subset of current matches. */ /* ndents = total; */ - +#ifdef MATCHFLTR + r = matches(pln); + if (r <= 0) { + !r ? unget_wch(KEY_BACKSPACE) : showfilter(ln); +#else if (matches(pln) == -1) { showfilter(ln); +#endif continue; }