zsh-workers
 help / color / mirror / code / Atom feed
* Path completion causing ambiguous path tail to disappear
@ 2000-02-21  4:11 Bart Schaefer
  2000-02-21  7:26 ` Andrej Borsenkow
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2000-02-21  4:11 UTC (permalink / raw)
  To: zsh-workers

This is not exactly a complaint, because I can (almost) get the behavior I
want by using a style ... rather it's a question of whether the default
behavior should be different.

I have my zsh sources under /usr/src/local/zsh/.  With dev-19:

zagzig[36] cd /usr/s/l/<TAB>

The valid completions at this point should be

/usr/src/local	/usr/src/linux /usr/share/libtool /usr/share/locale

However, what happens is that the word on the command line is *shortened*,
leaving me with

zagzig[36] cd /usr/s/

with the cursor on top of the final `/'.  Now, I don't mind the cursor
moving back to that point if that's where I need to disambiguate, but I
was surprised that zsh deleted the tail of the path rather than simply
feeping, or displaying the list.

Note that if I start with no trailing slash, i.e.

zagzig[36] cd /usr/s/l<TAB>

*then* the behavior is what I expect; the cursor moves back to the `/'
but the `l' remains on the line.

If I use

	zstyle ':completion:*:paths' expand prefix

Then I get the behavior I want from expand-or-complete, but not from
complete-word (which causes predict-on to break, which is how I really
noticed all of this in the first place).

Why does the trailing slash cause the `l/' to be deleted?

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: Path completion causing ambiguous path tail to disappear
  2000-02-21  4:11 Path completion causing ambiguous path tail to disappear Bart Schaefer
@ 2000-02-21  7:26 ` Andrej Borsenkow
  0 siblings, 0 replies; 3+ messages in thread
From: Andrej Borsenkow @ 2000-02-21  7:26 UTC (permalink / raw)
  To: Bart Schaefer, zsh-workers

 causing ambiguous path tail to disappear
>
>
> This is not exactly a complaint, because I can (almost) get the behavior I
> want by using a style ... rather it's a question of whether the default
> behavior should be different.
>
> I have my zsh sources under /usr/src/local/zsh/.  With dev-19:
>
> zagzig[36] cd /usr/s/l/<TAB>
>
> The valid completions at this point should be
>
> /usr/src/local	/usr/src/linux /usr/share/libtool /usr/share/locale
>
> However, what happens is that the word on the command line is *shortened*,
> leaving me with
>
> zagzig[36] cd /usr/s/
>

I noted this as well. It was introduced at some time fairly recently, I
believe.

But I think, it shortens path if some possibility is invalid. E.g. I have
/u1/lager directory; if I try

ls /u/l/l<TAB> I get

bor@itsrm2% l /u/l
u1@   usr/

because /u1/lager/l* do not exist (or so my explanation).

In your case ... do you have /usr/s<anyhing> that cause the above to fail
(just as me?) May it be, that trailing '/' makes zsh look, if subdirectorues
exist?

Yes, I believe, zsh is oversmart here. And it was different at some point.

/andrej


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Path completion causing ambiguous path tail to disappear
@ 2000-02-21  9:12 Sven Wischnowsky
  0 siblings, 0 replies; 3+ messages in thread
From: Sven Wischnowsky @ 2000-02-21  9:12 UTC (permalink / raw)
  To: zsh-workers


Bart Schaefer wrote:

> This is not exactly a complaint, because I can (almost) get the behavior I
> want by using a style ... rather it's a question of whether the default
> behavior should be different.
> 
> I have my zsh sources under /usr/src/local/zsh/.  With dev-19:
> 
> zagzig[36] cd /usr/s/l/<TAB>
> 
> The valid completions at this point should be
> 
> /usr/src/local	/usr/src/linux /usr/share/libtool /usr/share/locale
> 
> However, what happens is that the word on the command line is *shortened*,
> leaving me with
> 
> zagzig[36] cd /usr/s/
> 
> with the cursor on top of the final `/'.  Now, I don't mind the cursor
> moving back to that point if that's where I need to disambiguate, but I
> was surprised that zsh deleted the tail of the path rather than simply
> feeping, or displaying the list.

Slight problem with building the correct $SUFFIX for testing.

Bye
 Sven

diff -ru ../z.old/Completion/Core/_path_files Completion/Core/_path_files
--- ../z.old/Completion/Core/_path_files	Fri Feb 18 15:42:42 2000
+++ Completion/Core/_path_files	Mon Feb 21 10:11:36 2000
@@ -420,13 +420,13 @@
     fi
 
     if [[ "$tpre" = */* ]]; then
-      PREFIX="${donepath}${linepath}${cpre}${tpre%%/*}"
-      SUFFIX="/${tsuf#*/}"
       tmp2="${cpre}${tpre%%/*}"
+      PREFIX="${donepath}${linepath}${tmp2}"
+      SUFFIX="/${tpre#*/}${tsuf#*/}"
     else
-      PREFIX="${donepath}${linepath}${cpre}${tpre}"
-      SUFFIX="${tsuf}"
       tmp2="${cpre}${tpre}"
+      PREFIX="${donepath}${linepath}${tmp2}"
+      SUFFIX="${tsuf}"
     fi
 
     if (( tmp4 )) ||

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2000-02-21  9:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-02-21  4:11 Path completion causing ambiguous path tail to disappear Bart Schaefer
2000-02-21  7:26 ` Andrej Borsenkow
2000-02-21  9:12 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).