zsh-workers
 help / color / mirror / code / Atom feed
From: Zoltan Hidvegi <hzoli@cs.elte.hu>
To: zefram@dcs.warwick.ac.uk (Zefram)
Cc: pws@ifh.de, Harres@uwyo.edu, zsh-workers@math.gatech.edu
Subject: Re: MH command completion problems
Date: Tue, 7 Jan 1997 01:10:39 +0100 (MET)	[thread overview]
Message-ID: <199701070010.BAA01777@hzoli.ppp.cs.elte.hu> (raw)
In-Reply-To: <20178.199701061814@stone.dcs.warwick.ac.uk> from Zefram at "Jan 6, 97 06:14:22 pm"

> 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';


  reply	other threads:[~1997-01-07  0:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <199701061524.IAA05804@horseman.uwyo.edu>
1997-01-06 15:44 ` Peter Stephenson
1997-01-06 18:14   ` Zefram
1997-01-07  0:10     ` Zoltan Hidvegi [this message]
1997-01-07  0:35       ` John Harres

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199701070010.BAA01777@hzoli.ppp.cs.elte.hu \
    --to=hzoli@cs.elte.hu \
    --cc=Harres@uwyo.edu \
    --cc=pws@ifh.de \
    --cc=zefram@dcs.warwick.ac.uk \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).