Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: compctl -l with non-empty argument.
- X-seq: zsh-workers 6649
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: compctl -l with non-empty argument.
- Date: Wed, 16 Jun 1999 08:37:24 +0200 (MET DST)
- In-reply-to: Tanaka Akira's message of 16 Jun 1999 01:45:40 +0900
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
Tanaka Akira wrote:
> After above operation, compctl -L print follows.
>
> is27e1u11% compctl -L
> compctl -k '(a b c)' aaa
> compctl -l bbb bbb
> compctl -C -c -tn
> compctl -D -f -tn
> compctl -T
>
> Hmm. Argument for -l is replaced...
Hm, I can't reproduce this. Could you try the patch below and tell us
if it works?
Bye
Sven
diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- os/Zle/zle_tricky.c Wed Jun 16 08:22:35 1999
+++ Src/Zle/zle_tricky.c Wed Jun 16 08:31:46 1999
@@ -6507,7 +6507,7 @@
if (cc->subcmd) {
/* Handle -l sub-completion. */
char **ow = clwords, *os = cmdstr, *ops = NULL;
- int oldn = clwnum, oldp = clwpos;
+ int oldn = clwnum, oldp = clwpos, br;
unsigned long occ = ccont;
ccont = CC_CCCONT;
@@ -6523,21 +6523,22 @@
erange = 1;
clwnum = erange - brange + 1;
clwpos = clwpos - brange;
-
+ br = brange;
+
if (cc->subcmd[0]) {
/* And probably put the command name given to the flag *
* in the array. */
clwpos++;
clwnum++;
incmd = 0;
- ops = clwords[brange - 1];
- clwords[brange - 1] = cc->subcmd;
+ ops = clwords[br - 1];
+ clwords[br - 1] = ztrdup(cc->subcmd);
cmdstr = ztrdup(cc->subcmd);
- clwords += brange - 1;
+ clwords += br - 1;
} else {
- cmdstr = ztrdup(clwords[brange]);
+ cmdstr = ztrdup(clwords[br]);
incmd = !clwpos;
- clwords += brange;
+ clwords += br;
}
/* Produce the matches. */
makecomplistcmd(s, incmd, CFN_FIRST);
@@ -6548,8 +6549,10 @@
cmdstr = os;
clwnum = oldn;
clwpos = oldp;
- if (ops)
- clwords[brange - 1] = ops;
+ if (ops) {
+ zsfree(clwords[br - 1]);
+ clwords[br - 1] = ops;
+ }
ccont = occ;
}
if (cc->substr)
--
Sven Wischnowsky wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author