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.
master
Curtis McEnroe 2018-08-11 12:46:21 -04:00
parent 07c750d25c
commit 6323ca0209
No known key found for this signature in database
GPG Key ID: CEA2F97ADCFCD77C
1 changed files with 2 additions and 2 deletions

4
tab.c
View File

@ -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);
}