From 9fcc105ff68b4556883ef42d7c2959ada20a65d1 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Thu, 14 May 2015 11:04:19 +0000 Subject: 35127#1: Fix _describe/compdescribe problem with unsorted groups --- Src/Zle/compcore.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'Src/Zle/compcore.c') diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c index 000f9da2a..d4051bda0 100644 --- a/Src/Zle/compcore.c +++ b/Src/Zle/compcore.c @@ -2996,9 +2996,9 @@ mod_export void begcmgroup(char *n, int flags) { if (n) { - Cmgroup p = amatches; - - while (p) { + /* If a group named already exists, reuse it. */ + Cmgroup p; + for (p = amatches; p; p = p->next) { #ifdef ZSH_HEAP_DEBUG if (memory_validate(p->heap_id)) { HEAP_ERROR(p->heap_id); @@ -3016,9 +3016,10 @@ begcmgroup(char *n, int flags) return; } - p = p->next; } } + + /* Create a new group. */ mgroup = (Cmgroup) zhalloc(sizeof(struct cmgroup)); #ifdef ZSH_HEAP_DEBUG mgroup->heap_id = last_heap_id; -- cgit 1.4.1