summary refs log tree commit diff
path: root/complete.c
diff options
context:
space:
mode:
authorC. McEnroe2020-02-07 23:44:03 -0500
committerC. McEnroe2020-02-07 23:44:03 -0500
commit8b7cc1a0ed95e8a3ff413fa77eb12a3dca7fccb4 (patch)
treee43cd273a49365fefd2d3437da811bca350a56f2 /complete.c
parentd314523b90f41cfdbca867ad0ad48f2f68f66c58 (diff)
Clear completion for ID on self-part
Diffstat (limited to 'complete.c')
-rw-r--r--complete.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/complete.c b/complete.c
index 5067512..437bb7d 100644
--- a/complete.c
+++ b/complete.c
@@ -122,3 +122,15 @@ void completeRemove(size_t id, const char *str) {
 		free(node);
 	}
 }
+
+void completeClear(size_t id) {
+	struct Node *next = NULL;
+	for (struct Node *node = head; node; node = next) {
+		next = node->next;
+		if (node->id != id) continue;
+		if (match == node) match = NULL;
+		detach(node);
+		free(node->str);
+		free(node);
+	}
+}