From 0d888b88d0d8e4853e0d23e00b3183a7b60ab877 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Thu, 17 Jun 2021 18:43:26 -0400 Subject: Match windows by substring in /window This could just iterate over idNames instead, but using complete means more recently used windows will match first. --- complete.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'complete.c') diff --git a/complete.c b/complete.c index 5835926..ead2457 100644 --- a/complete.c +++ b/complete.c @@ -119,6 +119,15 @@ const char *complete(uint id, const char *prefix) { return NULL; } +const char *completeSubstr(uint id, const char *substr) { + for (match = (match ? match->next : head); match; match = match->next) { + if (match->id && match->id != id) continue; + if (!strcasestr(match->str, substr)) continue; + return match->str; + } + return NULL; +} + void completeAccept(void) { if (match) prepend(detach(match)); match = NULL; -- cgit 1.4.1