* PATCH: Re: Bad interaction between -iprefix and -string
@ 1999-02-11 15:41 Sven Wischnowsky
0 siblings, 0 replies; 2+ messages in thread
From: Sven Wischnowsky @ 1999-02-11 15:41 UTC (permalink / raw)
To: zsh-workers
Peter Stephenson wrote:
> This came out of my attempts to handle dd, but here's a simpler test.
> The [[ ... ]] stuck on its own looks funny, but it relies on the side
> effect on IPREFIX.
>
> % defcomp stest
> % which __stest
> __stest () {
> if [[ -iprefix name= ]]
> then
> [[ -string , ]]
> complist -k '(yan tan tethera dick)'
> fi
> }
> % stest name=y<TAB> # produces...
> % stest name=yan # OK so far, add `,te' by hand...
> % stest name=yan,te<TAB> # produces...
> % stest name=yan,tedick # The te is being ignored, too.
I forgot to ignore the already ignored prefix for this kind of
condition.
Stuff like the above makes me think that even more control over the
inserted suffixes would be nice. In this case: make a `,' fall in
place automatically.
Bye
Sven
--- os/Zle/compctl.c Tue Feb 9 09:22:04 1999
+++ Src/Zle/compctl.c Thu Feb 11 16:36:41 1999
@@ -2025,7 +2025,7 @@
{
if (comp_check()) {
char *s;
- int i;
+ int i, ipl;
if (a[1]) {
s = cond_str(a, 1);
@@ -2038,9 +2038,9 @@
zerr("zle not loaded, zle condition not available", NULL, 0);
return 1;
}
- i = getcpatptr(comp_strptr(NULL, NULL), i, s, id);
+ i = getcpatptr(comp_strptr(&ipl, NULL), i, s, id);
if (i != -1) {
- ignore_prefix(i);
+ ignore_prefix(i - ipl);
return 1;
}
}
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: PATCH: Re: Bad interaction between -iprefix and -string
@ 1999-02-11 16:34 Sven Wischnowsky
0 siblings, 0 replies; 2+ messages in thread
From: Sven Wischnowsky @ 1999-02-11 16:34 UTC (permalink / raw)
To: zsh-workers
I wrote:
> Peter Stephenson wrote:
>
> > % stest name=y<TAB> # produces...
> > % stest name=yan # OK so far, add `,te' by hand...
> > % stest name=yan,te<TAB> # produces...
> > % stest name=yan,tedick # The te is being ignored, too.
>
> Stuff like the above makes me think that even more control over the
> inserted suffixes would be nice. In this case: make a `,' fall in
> place automatically.
That was nonsense, of course. This:
__stest () {
if [[ -iprefix name= ]]
then
[[ -string , ]]
compadd -qr ',' -S ' ' -m yan tan tethera dick
fi
}
should work perfectly well. But at least trying it revealed two bugs:
with the `-m' option compadd should use IPREFIX and in addmatches()
(which is the function used for compadd) we shouldn't tokenize the
contents of the completion variables.
With the patch below, it works.
Bye
Sven
--- os/Zle/zle_tricky.c Mon Feb 8 13:18:36 1999
+++ Src/Zle/zle_tricky.c Thu Feb 11 17:31:46 1999
@@ -2489,16 +2489,15 @@
SWITCHHEAPS(compheap) {
HEAPALLOC {
if (aflags & CAF_MATCH) {
- ctokenize(lipre = dupstring(compiprefix));
- remnulargs(lipre);
- ctokenize(lpre = dupstring(compprefix));
- remnulargs(lpre);
+ lipre = dupstring(compiprefix);
+ lpre = dupstring(compprefix);
llpl = strlen(lpre);
- ctokenize(lsuf = dupstring(compsuffix));
- remnulargs(lsuf);
+ lsuf = dupstring(compsuffix);
}
if (ipre)
ipre = (lipre ? dyncat(lipre, ipre) : dupstring(ipre));
+ else if (lipre)
+ ipre = lipre;
if (ppre) {
ppre = dupstring(ppre);
lpl = strlen(ppre);
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1999-02-11 16:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-02-11 15:41 PATCH: Re: Bad interaction between -iprefix and -string Sven Wischnowsky
1999-02-11 16:34 Sven Wischnowsky
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).