about summary refs log tree commit diff
path: root/Src/Zle/compcore.c
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2015-05-14 11:04:19 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2015-05-23 10:05:06 +0000
commit9fcc105ff68b4556883ef42d7c2959ada20a65d1 (patch)
tree85d9c69b63306585afafd620157b270997d09462 /Src/Zle/compcore.c
parent2f6a8a6c6c3774ac6f9317288adf03e2a065cb42 (diff)
downloadzsh-9fcc105ff68b4556883ef42d7c2959ada20a65d1.tar.gz
zsh-9fcc105ff68b4556883ef42d7c2959ada20a65d1.tar.xz
zsh-9fcc105ff68b4556883ef42d7c2959ada20a65d1.zip
35127#1: Fix _describe/compdescribe problem with unsorted groups
Diffstat (limited to 'Src/Zle/compcore.c')
-rw-r--r--Src/Zle/compcore.c9
1 files changed, 5 insertions, 4 deletions
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 <n> 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;