Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
compadd -E 0 should imply -J and -2
- X-seq: zsh-workers 35704
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxx>
- Subject: compadd -E 0 should imply -J and -2
- Date: Mon, 06 Jul 2015 16:26:07 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1436192768; bh=p/sIyN2vM5ap3Z593O03qZ17igpRjjkGUQZAJJUfC94=; h=From:To:Subject:Date:From:Subject; b=X+ugRlXEiIfIcijK99Vp3rHYMYTuQl54T9clgwbk8Z5ipE0jJW/S6+Cwj4gtMmnuNRGHKCIpiVtX/Eb6TYcILrIOzTVTWZs2z3nnMaeTbmKP4oQ6erXlNjuNn4aWlZutfOO+pYkRQpLqrE9sF/Tzd4XaA/r9HEXEOEzwa+DJfbGrJQC+N1LQWu5JwFYNU9qT952jv+fjunB9mt1m+KFuImhcOWTIhMPv24Ud4EQdObCOr9apBppx79CbY5EjUqbQMzu74BU9aYiPvD2V04yAgjINIA+LOgi7giL/QNmgglWTfr8uNRCG63QwI6dyHRyNHFkKPKy0r8+sl3EL8zy4vQ==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
With compadd -E, the -J (unsorted) and -2 (remove duplicates) options
are implied. They both affect the name space (group) into which matches
are added.
At certain terminal sizes, my function was using -E 0 and my layout was
all mucked up. The cause wasn't as obvious as it perhaps should have
been.
bin_compadd generates an error for negative arguments to -E. Being able
to pass -E 0 allows my function to be simpler so rather than change the
error condition from < 0 to < 1, this patch forces -E 0 to also imply the
-J and -2 options. I've also added a sentence to the documentation.
Oliver
diff --git a/Doc/Zsh/compwid.yo b/Doc/Zsh/compwid.yo
index 0c0a15d..40cabea 100644
--- a/Doc/Zsh/compwid.yo
+++ b/Doc/Zsh/compwid.yo
@@ -697,7 +697,9 @@ format completion lists and to make explanatory string be shown in
completion lists (since empty matches can be given display strings
with the tt(-d) option). And because all but one empty string would
otherwise be removed, this option implies the tt(-V) and tt(-2)
-options (even if an explicit tt(-J) option is given).
+options (even if an explicit tt(-J) option is given). This can be
+important to note as it affects the name space into which matches are
+added.
)
xitem(tt(-))
item(tt(-)tt(-))(
diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index ba538ca..2cbb6ac 100644
--- a/Src/Zle/compcore.c
+++ b/Src/Zle/compcore.c
@@ -2049,7 +2049,7 @@ addmatches(Cadata dat, char **argv)
Heap oldheap;
SWITCHHEAPS(oldheap, compheap) {
- if (dat->dummies)
+ if (dat->dummies >= 0)
dat->aflags = ((dat->aflags | CAF_NOSORT | CAF_UNIQCON) &
~CAF_UNIQALL);
diff --git a/Src/Zle/complete.c b/Src/Zle/complete.c
index 63e5b91..4cf88f3 100644
--- a/Src/Zle/complete.c
+++ b/Src/Zle/complete.c
@@ -537,7 +537,7 @@ bin_compadd(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
dat.match = NULL;
dat.flags = 0;
dat.aflags = CAF_MATCH;
- dat.dummies = 0;
+ dat.dummies = -1;
for (; *argv && **argv == '-'; argv++) {
if (!(*argv)[1]) {
Messages sorted by:
Reverse Date,
Date,
Thread,
Author