summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-08-11 12:46:21 -0400
committerJune McEnroe <june@causal.agency>2018-08-11 12:46:21 -0400
commit6323ca0209383cec1bf774f9723b63a5a4685710 (patch)
tree67c4cb2ac7ca62fea06b58373f43d2e757284c02
parentBecome multi-channel (diff)
downloadcatgirl-6323ca0209383cec1bf774f9723b63a5a4685710.tar.gz
catgirl-6323ca0209383cec1bf774f9723b63a5a4685710.zip
Fix removing entries during tab complete
Since tabNext starts on match->next, if match gets removed, it should be
set to match->prev so that tabNext will start in the same spot.
-rw-r--r--tab.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tab.c b/tab.c
index a6bb795..c0a96a4 100644
--- a/tab.c
+++ b/tab.c
@@ -81,7 +81,7 @@ void tabRemove(struct Tag tag, const char *word) {
 		if (tag.id != TAG_ALL.id && entry->tag != tag.id) continue;
 		if (strcmp(entry->word, word)) continue;
 		unlink(entry);
-		if (match == entry) match = entry->next;
+		if (match == entry) match = entry->prev;
 		free(entry->word);
 		free(entry);
 		return;
@@ -92,7 +92,7 @@ void tabClear(struct Tag tag) {
 	for (struct Entry *entry = head; entry; entry = entry->next) {
 		if (entry->tag != tag.id) continue;
 		unlink(entry);
-		if (match == entry) match = entry->next;
+		if (match == entry) match = entry->prev;
 		free(entry->word);
 		free(entry);
 	}