zsh-users
 help / color / mirror / code / Atom feed
* Directory-only `cd' completion via compctl bug
@ 1998-03-19 19:44 Eddy J. Gurney
  1998-03-20 14:26 ` Andrej Borsenkow
  0 siblings, 1 reply; 3+ messages in thread
From: Eddy J. Gurney @ 1998-03-19 19:44 UTC (permalink / raw)
  To: zsh-users

I'm using the cd completion routines from the "example" compctl file
provided with the zsh distribution:

# Another possibility for cd/pushd is to use it in conjunction with the
# cdmatch function (in the Functions subdirectory of zsh distribution).

if [[ -o AUTO_REMOVE_SLASH ]] then
    compctl -x 'p[2]' -Q -K cdmatch2 - 'S[/][~][./][../]' -g '*(-/)' + \
        -g '*(-/D)' - 'n[-1,/], s[]' -K cdmatch -q -S '/' -- cd pushd
else
    compctl -x 'p[2]' -Q -K cdmatch2 - 'S[/][~][./][../]' -g '*(-/)' + \
        -g '*(-/D)' - 'n[-1,/], s[]' -K cdmatch -S '/' -- cd pushd
fi

This works great... except for one case that I've found so far.

If you try to CD into a directory with spaces in the name, for some
reason it escapes the backslashes:

cd Schoolhouse\\\ Rock\\\ -\\\ America\\\ Rock/

instead of

cd Schoolhouse\ Rock\ -\ America\ Rock/

Any ideas how to fix it? (Note that is doesn't do it if there is a leading
slash, i.e., `cd ./Sc[tab]' works fine but `cd Sc[tab]' does not.)

Eddy


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

* Re: Directory-only `cd' completion via compctl bug
  1998-03-19 19:44 Directory-only `cd' completion via compctl bug Eddy J. Gurney
@ 1998-03-20 14:26 ` Andrej Borsenkow
  1998-03-24 16:34   ` Eddy J. Gurney
  0 siblings, 1 reply; 3+ messages in thread
From: Andrej Borsenkow @ 1998-03-20 14:26 UTC (permalink / raw)
  To: Eddy J. Gurney; +Cc: zsh-users

On Thu, 19 Mar 1998, Eddy J. Gurney wrote:

> 
> # Another possibility for cd/pushd is to use it in conjunction with the
> # cdmatch function (in the Functions subdirectory of zsh distribution).
> 
> if [[ -o AUTO_REMOVE_SLASH ]] then
>     compctl -x 'p[2]' -Q -K cdmatch2 - 'S[/][~][./][../]' -g '*(-/)' + \
>         -g '*(-/D)' - 'n[-1,/], s[]' -K cdmatch -q -S '/' -- cd pushd
> else
>     compctl -x 'p[2]' -Q -K cdmatch2 - 'S[/][~][./][../]' -g '*(-/)' + \
>         -g '*(-/D)' - 'n[-1,/], s[]' -K cdmatch -S '/' -- cd pushd
> fi
> 
> This works great... except for one case that I've found so far.
> 
> If you try to CD into a directory with spaces in the name, for some
> reason it escapes the backslashes:
> 
> cd Schoolhouse\\\ Rock\\\ -\\\ America\\\ Rock/
> 

Just tried with zsg-3.1.2-zefram3 (+some patches) and it works quite fine.
I am using the same completion. Which zsh version do you have? Try to
start with vanilla zsh -f (may be, some options you set cause it). 


-------------------------------------------------------------------------
Andrej Borsenkow 		Fax:   +7 (095) 796 99 20
SNI ITS Moscow			Tel:   +7 (095) 796 99 24

NERV:  borsenkow.msk		E-Mail: borsenkow.msk@sni.de
-------------------------------------------------------------------------



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

* Re: Directory-only `cd' completion via compctl bug
  1998-03-20 14:26 ` Andrej Borsenkow
@ 1998-03-24 16:34   ` Eddy J. Gurney
  0 siblings, 0 replies; 3+ messages in thread
From: Eddy J. Gurney @ 1998-03-24 16:34 UTC (permalink / raw)
  To: zsh-users

On Mar 20 at 17:26, Andrej Borsenkow wrote:
,--
| > # Another possibility for cd/pushd is to use it in conjunction with the
| > # cdmatch function (in the Functions subdirectory of zsh distribution).
| >
| > if [[ -o AUTO_REMOVE_SLASH ]] then
| >     compctl -x 'p[2]' -Q -K cdmatch2 - 'S[/][~][./][../]' -g '*(-/)' + \
| >         -g '*(-/D)' - 'n[-1,/], s[]' -K cdmatch -q -S '/' -- cd pushd
| > else
| >     compctl -x 'p[2]' -Q -K cdmatch2 - 'S[/][~][./][../]' -g '*(-/)' + \
| >         -g '*(-/D)' - 'n[-1,/], s[]' -K cdmatch -S '/' -- cd pushd
| > fi
| >
| > This works great... except for one case that I've found so far.
| >
| > If you try to CD into a directory with spaces in the name, for some
| > reason it escapes the backslashes:
| >
| > cd Schoolhouse\\\ Rock\\\ -\\\ America\\\ Rock/
|
| Just tried with zsg-3.1.2-zefram3 (+some patches) and it works quite fine.
| I am using the same completion. Which zsh version do you have? Try to
| start with vanilla zsh -f (may be, some options you set cause it).
`--
Nope, I still can't get it to work correctly.

gizmo:~> zsh-3.1.2-zefram3/Src/zsh -f
gizmo% echo $ZSH_VERSION
3.1.2-zefram3

I then pasted in the above `cd' compctl defintion, and pasted in the
`cdmatch' function. Exact same bahavior:

gizmo% cd T<tab>
Test\\\ -\\\ abc     Test\\\ -\\\ ghi
Test\\\ -\\\ def     Trouble\\\ -\\\ abc
gizmo% cd Tr<tab> -> cd Trouble\\\ -\\\ abc/
cd: no such file or directory: Trouble\ -\ abc/
gizmo% cd ./Tr<tab> -> cd ./Trouble\ -\ abc/

My 3.1.2-zefram3 has patches 3713, 3714 and 3739 applied. But I get the
same behavior described above under zsh-3.0.2 as well.


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

end of thread, other threads:[~1998-03-24 16:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-03-19 19:44 Directory-only `cd' completion via compctl bug Eddy J. Gurney
1998-03-20 14:26 ` Andrej Borsenkow
1998-03-24 16:34   ` Eddy J. Gurney

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).