* Re: MH command completion problems
[not found] <199701061524.IAA05804@horseman.uwyo.edu>
@ 1997-01-06 15:44 ` Peter Stephenson
1997-01-06 18:14 ` Zefram
0 siblings, 1 reply; 4+ messages in thread
From: Peter Stephenson @ 1997-01-06 15:44 UTC (permalink / raw)
To: John Harres; +Cc: zsh-workers
John Harres wrote:
> I tried the ^D, and you are right, it did list the subfolders correctly.
> Subsequently hitting <tab> still only inserts more /'s.
I think it must be a shell bug. See if you get the problem with:
tstfn() { reply=("${1%/*}/foo" "${1%/*}/bar") }
compctl -K tstfn -S / -q tstfn
tstfn foo/<TAB>
This certainly gives me the double / (you can't get any more because
of the way tstfn is defined), but autolist does work for me.
--
Peter Stephenson <pws@ifh.de> Tel: +49 33762 77366
WWW: http://www.ifh.de/~pws/ Fax: +49 33762 77413
Deutsches Elektronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: MH command completion problems
1997-01-06 15:44 ` MH command completion problems Peter Stephenson
@ 1997-01-06 18:14 ` Zefram
1997-01-07 0:10 ` Zoltan Hidvegi
0 siblings, 1 reply; 4+ messages in thread
From: Zefram @ 1997-01-06 18:14 UTC (permalink / raw)
To: Peter Stephenson; +Cc: Harres, zsh-workers
Peter Stephenson wrote:
>tstfn() { reply=("${1%/*}/foo" "${1%/*}/bar") }
>compctl -K tstfn -S / -q tstfn
>tstfn foo/<TAB>
>
>This certainly gives me the double / (you can't get any more because
>of the way tstfn is defined), but autolist does work for me.
Yes, it's a shell bug. In the above scenario, tstfn is getting
arguments "foo" and "". The already-present suffix is being ignored at
that point, for completion purposes. The function returns completions
"foo/foo" and "foo/bar". If I recall the internals correctly, this is
being interpreted as requiring the addition of "/foo" or "/bar" to the
existing string "foo". However, the additions are being applied to the
string actually there, "foo/", which the function saw no indication
of.
Theoretically, it's a simple matter of programming to make the -S
suffix be added in the right place. Actually it's a bit of a
nightmare.
-zefram
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: MH command completion problems
1997-01-06 18:14 ` Zefram
@ 1997-01-07 0:10 ` Zoltan Hidvegi
1997-01-07 0:35 ` John Harres
0 siblings, 1 reply; 4+ messages in thread
From: Zoltan Hidvegi @ 1997-01-07 0:10 UTC (permalink / raw)
To: Zefram; +Cc: pws, Harres, zsh-workers
> Peter Stephenson wrote:
> >tstfn() { reply=("${1%/*}/foo" "${1%/*}/bar") }
> >compctl -K tstfn -S / -q tstfn
> >tstfn foo/<TAB>
> >
> >This certainly gives me the double / (you can't get any more because
> >of the way tstfn is defined), but autolist does work for me.
>
> Yes, it's a shell bug. In the above scenario, tstfn is getting
> arguments "foo" and "". The already-present suffix is being ignored at
> that point, for completion purposes. The function returns completions
> "foo/foo" and "foo/bar". If I recall the internals correctly, this is
> being interpreted as requiring the addition of "/foo" or "/bar" to the
> existing string "foo". However, the additions are being applied to the
> string actually there, "foo/", which the function saw no indication
> of.
>
> Theoretically, it's a simple matter of programming to make the -S
> suffix be added in the right place. Actually it's a bit of a
> nightmare.
I think it is not a nightmare. Try this patch (for zsh-3.0.x go to the Src
directory first).
Zoltan
*** Src/Zle/zle_tricky.c 1997/01/06 03:06:15 3.1.1.8
--- Src/Zle/zle_tricky.c 1997/01/07 00:01:35
***************
*** 2253,2259 ****
/* If the suffix is already there, ignore it (and don't add *
* it again). */
if (*sd && (suffixll = strlen(sd)) >= sl &&
! !strcmp(sdup, sd + suffixll - sl)) {
ccsuffix = NULL;
haswhat |= HAS_SUFFIX;
s[suffixll - sl] = '\0';
--- 2253,2259 ----
/* If the suffix is already there, ignore it (and don't add *
* it again). */
if (*sd && (suffixll = strlen(sd)) >= sl &&
! offs <= suffixll - sl && !strcmp(sdup, sd + suffixll - sl)) {
ccsuffix = NULL;
haswhat |= HAS_SUFFIX;
s[suffixll - sl] = '\0';
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: MH command completion problems
1997-01-07 0:10 ` Zoltan Hidvegi
@ 1997-01-07 0:35 ` John Harres
0 siblings, 0 replies; 4+ messages in thread
From: John Harres @ 1997-01-07 0:35 UTC (permalink / raw)
To: Zoltan Hidvegi; +Cc: Zefram, pws, Harres, zsh-workers
> > Peter Stephenson wrote:
> > >tstfn() { reply=("${1%/*}/foo" "${1%/*}/bar") }
> > >compctl -K tstfn -S / -q tstfn
> > >tstfn foo/<TAB>
> > >
> > >This certainly gives me the double / (you can't get any more because
> > >of the way tstfn is defined), but autolist does work for me.
> >
> > Yes, it's a shell bug. In the above scenario, tstfn is getting
> > arguments "foo" and "". The already-present suffix is being ignored at
> > that point, for completion purposes. The function returns completions
> > "foo/foo" and "foo/bar". If I recall the internals correctly, this is
> > being interpreted as requiring the addition of "/foo" or "/bar" to the
> > existing string "foo". However, the additions are being applied to the
> > string actually there, "foo/", which the function saw no indication
> > of.
> >
> > Theoretically, it's a simple matter of programming to make the -S
> > suffix be added in the right place. Actually it's a bit of a
> > nightmare.
>
> I think it is not a nightmare. Try this patch (for zsh-3.0.x go to the Src
> directory first).
>
> Zoltan
Fixed both problems for me. THANKS!
John Harres
harres@uwyo.edu
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1997-01-07 0:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <199701061524.IAA05804@horseman.uwyo.edu>
1997-01-06 15:44 ` MH command completion problems Peter Stephenson
1997-01-06 18:14 ` Zefram
1997-01-07 0:10 ` Zoltan Hidvegi
1997-01-07 0:35 ` John Harres
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).