From 328a60e0d3af75a45f0c9abd89c2ce9b9bb9a506 Mon Sep 17 00:00:00 2001 From: bakkeby Date: Tue, 24 Aug 2021 16:54:57 +0200 Subject: [PATCH] Addressing prefixcompletion vs fuzzymatch compatibility issue ref. #5 --- dmenu.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dmenu.c b/dmenu.c index 5e13150..facf7f6 100644 --- a/dmenu.c +++ b/dmenu.c @@ -1248,7 +1248,14 @@ insert: break; case XK_Tab: #if PREFIXCOMPLETION_PATCH - if (!matches) break; /* cannot complete no matches */ + if (!matches) + break; /* cannot complete no matches */ + #if FUZZYMATCH_PATCH + /* only do tab completion if all matches start with prefix */ + for (item = matches; item && item->text; item = item->right) + if (item->text[0] != text[0]) + goto draw; + #endif // FUZZYMATCH_PATCH strncpy(text, matches->text, sizeof text - 1); text[sizeof text - 1] = '\0'; len = cursor = strlen(text); /* length of longest common prefix */