zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@ibmth.df.unipi.it>
To: zsh-workers@math.gatech.edu
Subject: Re: 'remove slash' bug
Date: Mon, 15 Jun 1998 18:35:41 +0200	[thread overview]
Message-ID: <9806151635.AA39550@ibmth.df.unipi.it> (raw)
In-Reply-To: ""Bart Schaefer""'s message of "Sun, 14 Jun 1998 14:16:38 DFT." <980614141639.ZM315@candle.brasslantern.com>

"Bart Schaefer" wrote:
> zsh% /usr/
> 
> Move the cursor to the 's'.  Press TAB.
> 
> 3.0.5	-->	/usr/
> 3.1.4	-->	/usr//

This seems to be trivial to fix, as appended (expect a couple of lines
of offset).  When it is, however, you get the other behaviour noted...

> I can't come up with any case that deletes anything other than slashes or
> spaces.  Here's how to get it to delete a space:
> 
> zsh% touch /tmp/foo
> zsh% ls /tm/foo
> 
> Move the cursor to the 'm' and press TAB.  In both 3.0.5 and 3.1.4, this
> produces "ls /tmp/foo " (note the trailing space).  In 3.1.4, typing any
> further key other than self-insert deletes the trailing space.  3.0.5
> leaves the space alone.

This seems to be standard behaviour in 3.1.4.  Just type `ls
/tmp/foo', hit tab, and you'll see the space is autoremovable anyway.
There is a quite deliberate test for this in the code at the moment,
so somebody (Zefram?) thought it was a good idea.  What should happen?

1 Present (3.1.4) behaviour
2 Space added, but left alone (not autoremovable)
  (i) if the cursor had to be moved to the end of the word
  (ii) even if the cursor was at the end of the word already
3 No space added if the cursor was previously not at the end of
the line, i.e. you would get /tmp/foo with the cursor immediately
after the foo.  In that case, another tab would add a space, although
with the /usr/ example you would get completion inside the directory
at that point (which you could with an autoremovable space, but less
intuitively).  In this case any space added could still be
  (i) autoremovable
  (ii) not

(Not adding any space ever is probably not sensible.)

All of these can readily be produced.  I presume 2(ii) was the
previous behaviour.

***************
*** 3441,3447 ****
  			fsuf, psuf);
  	    }
  	    /* And do the stat. */
! 	    if (!ztat(p, &buf, 0) && S_ISDIR(buf.st_mode)) {
  		/* It is a directory, so add the slash. */
  		havesuff = 1;
  		inststrlen("/", 1, 1);
--- 3442,3449 ----
  			fsuf, psuf);
  	    }
  	    /* And do the stat. */
! 	    if (p[strlen(p)-1] != '/' && !ztat(p, &buf, 0) &&
! 		S_ISDIR(buf.st_mode)) {
  		/* It is a directory, so add the slash. */
  		havesuff = 1;
  		inststrlen("/", 1, 1);

-- 
Peter Stephenson <pws@ibmth.df.unipi.it>       Tel: +39 50 844536
WWW:  http://www.ifh.de/~pws/
Gruppo Teorico, Dipartimento di Fisica
Piazza Torricelli 2, 56100 Pisa, Italy


  parent reply	other threads:[~1998-06-15 16:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-06-07 22:41 Timothy J Luoma
1998-06-08  0:22 ` Bart Schaefer
1998-06-08  0:53   ` Timothy J Luoma
1998-06-08  3:56 ` Wayne Davison
1998-06-14 13:56   ` TGAPE!
1998-06-14 21:16     ` Bart Schaefer
1998-06-15  6:49       ` Mircea Damian
1998-06-15 16:34         ` Timothy J Luoma
1998-06-15 16:35       ` Peter Stephenson [this message]
1998-06-16  5:21         ` Bart Schaefer
1998-06-16  9:41           ` Peter Stephenson
1998-06-21 18:01 Bart Schaefer

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=9806151635.AA39550@ibmth.df.unipi.it \
    --to=pws@ibmth.df.unipi.it \
    --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).