about summary refs log tree commit diff
path: root/complete.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--complete.c9
1 files changed, 9 insertions, 0 deletions
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;