* [zsh 4.0.1 bug] filename completion
@ 2001-06-25 23:01 Vincent Lefevre
2001-06-26 5:15 ` Bart Schaefer
0 siblings, 1 reply; 13+ messages in thread
From: Vincent Lefevre @ 2001-06-25 23:01 UTC (permalink / raw)
To: Mailing-list zsh-users
When I type "cd s" and try to complete (with expand-or-complete),
I get the following possibilities:
scripts/ share/ software/ sparc-solaris/ src/
When I type "cd so", "cd sof", "cd softw", "cd softwa"... and try
to complete, I get "cd software/". But when I type "cd soft" and
try to complete, nothing happens. Note that here, soft is a named
directory, but the above behaviour should be incorrect.
--
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/> - 100%
validated HTML - Acorn Risc PC, Yellow Pig 17, Championnat International des
Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [zsh 4.0.1 bug] filename completion
2001-06-25 23:01 [zsh 4.0.1 bug] filename completion Vincent Lefevre
@ 2001-06-26 5:15 ` Bart Schaefer
2001-06-26 8:35 ` Andrej Borsenkow
2001-06-26 9:41 ` Vincent Lefevre
0 siblings, 2 replies; 13+ messages in thread
From: Bart Schaefer @ 2001-06-26 5:15 UTC (permalink / raw)
To: Mailing-list zsh-users
On Jun 26, 1:01am, Vincent Lefevre wrote:
} Subject: [zsh 4.0.1 bug] filename completion
}
} scripts/ share/ software/ sparc-solaris/ src/
}
} When I type "cd so", "cd sof", "cd softw", "cd softwa"... and try
} to complete, I get "cd software/". But when I type "cd soft" and
} try to complete, nothing happens. Note that here, soft is a named
} directory, but the above behaviour should be incorrect.
It took me a while to figure out which "above behavior" you meant.
The situation seems to be that you have CDABLE_VARS set and `soft' is
the name of the variable.
Either the handling of named directories by _cd is broken, or the
handling of named directories by _path_files is; I'm not sure which,
and it may even be both.
_cd doesn't even try to complete other directories if the prefix is the
name of a cdable variable, which is arguably wrong.
But even so, after _cd sets PREFIX="~$PREFIX" and calls _path_files, the
completion gets botched somehow ... _path_files calls (eventually the
equivalent of, at line 326)
tmp1=( ~soft/ )
compfiles -p tmp1 accex '' '' fake '*(-/)'
The trouble there seems to be that compfiles tries to match ~soft/*(-/) to
~soft and (obviously) fails. The slash is getting added at line 254 of
_path_files; my guess is that needs to become conditional on whether the
prefix originally contained a slash, but that means in turn that the test
on line 255 has to change, etc.
I fooled around with _cd a bit and got something that works, but I'm not
happy with it, so I'm going to hope that Sven has a better idea of what's
going on.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: [zsh 4.0.1 bug] filename completion
2001-06-26 5:15 ` Bart Schaefer
@ 2001-06-26 8:35 ` Andrej Borsenkow
2001-06-26 9:01 ` Sven Wischnowsky
2001-06-26 10:10 ` Vincent Lefevre
2001-06-26 9:41 ` Vincent Lefevre
1 sibling, 2 replies; 13+ messages in thread
From: Andrej Borsenkow @ 2001-06-26 8:35 UTC (permalink / raw)
To: Mailing-list zsh-users
>
> _cd doesn't even try to complete other directories if the prefix is the
> name of a cdable variable, which is arguably wrong.
>
I suspect it is part of more general problem. I have a feeling that handling
of exact match changed at some point near 4.0.1 release. Now zsh will prefer
exact match in any context while before I got menu selection ... and I am
sure none of my styles changed.
E.g. I have /usr/lib{,64s}/netlib. Attempt to complete /u/l/n always
completes /usr/lib/netlib. Styles are:
bor@itsrm2% zstyle -L
zstyle ':completion:*' completer _oldlist _complete _match
zstyle ':completion:*:warnings' format 'No matches for: %d'
zstyle ':completion:*' format '%BCompleting %d%b'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' insert-unambiguous true
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' list-prompt '%SAt %p: Hit TAB for more, or the
character to insert%s'
zstyle ':completion:*' match-original both
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' '+r:|[._-]=** r:|=**'
zstyle ':completion:*' menu 'select=long-list' 'select=0'
zstyle ':completion:*' verbose true
zstyle :compinstall filename /home/bor/.zcompletion
zstyle ':completion:*:*:configure:*' tag-order 'options:-with:with\ options
options:-other:other\ options' 'options:-without:without\ options'
zstyle ':completion:*:options-with' ignored-patterns '^--with-*'
zstyle ':completion:*:options-without' ignored-patterns '^--without-*'
zstyle ':completion:*:options-other' ignored-patterns '--with(|out)-*'
zstyle ':completion:*' ambiguous true
zstyle ':completion:*' list-rows-first true
zstyle ':completion:*:processes' command '
if (($EUID && !${+NUMERIC})); then
ps -fu $EUID
else
ps -fe
fi
'
-andrej
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: RE: [zsh 4.0.1 bug] filename completion
2001-06-26 8:35 ` Andrej Borsenkow
@ 2001-06-26 9:01 ` Sven Wischnowsky
2001-06-26 10:10 ` Vincent Lefevre
1 sibling, 0 replies; 13+ messages in thread
From: Sven Wischnowsky @ 2001-06-26 9:01 UTC (permalink / raw)
To: zsh-users
Andrej Borsenkow wrote:
> >
> > _cd doesn't even try to complete other directories if the prefix is the
> > name of a cdable variable, which is arguably wrong.
> >
>
> I suspect it is part of more general problem. I have a feeling that handling
> of exact match changed at some point near 4.0.1 release. Now zsh will prefer
> exact match in any context while before I got menu selection ... and I am
> sure none of my styles changed.
>
> E.g. I have /usr/lib{,64s}/netlib. Attempt to complete /u/l/n always
> completes /usr/lib/netlib. Styles are:
Oops. You are right, that test in `compfiles -r' was too stupid (its
the test used in the loop that finds the first ambiguous component and
it didn't add a slash when comparin in-path components, so it thought
`lib' was the same as `lib64s' in this case).
And yes, this also makes it offer both `soft' and `software' in that
other case.
I'm still not overly happy with the code in _cd, though.
This should go into 4.0.2, too, I think.
Bye
Sven
Index: Src/Zle/computil.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/computil.c,v
retrieving revision 1.61
diff -u -r1.61 computil.c
--- Src/Zle/computil.c 2001/06/19 15:46:54 1.61
+++ Src/Zle/computil.c 2001/06/26 09:02:09
@@ -3719,6 +3719,8 @@
if ((q = strchr((p = dupstring(p)), '/')))
*q = '\0';
+ p = dyncat(p, "/");
+
for (; *names; names++)
if (!strpfx(p, *names)) {
*amb = 1;
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [zsh 4.0.1 bug] filename completion
2001-06-26 5:15 ` Bart Schaefer
2001-06-26 8:35 ` Andrej Borsenkow
@ 2001-06-26 9:41 ` Vincent Lefevre
1 sibling, 0 replies; 13+ messages in thread
From: Vincent Lefevre @ 2001-06-26 9:41 UTC (permalink / raw)
To: zsh-users
On 26 Jun, Bart Schaefer <schaefer@candle.brasslantern.com> wrote:
> The situation seems to be that you have CDABLE_VARS set and `soft' is
> the name of the variable.
Yes, I have CDABLE_VARS set and "soft" is one of the named directories.
--
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/> - 100%
validated HTML - Acorn Risc PC, Yellow Pig 17, Championnat International des
Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [zsh 4.0.1 bug] filename completion
2001-06-26 8:35 ` Andrej Borsenkow
2001-06-26 9:01 ` Sven Wischnowsky
@ 2001-06-26 10:10 ` Vincent Lefevre
2001-06-26 10:28 ` Andrej Borsenkow
1 sibling, 1 reply; 13+ messages in thread
From: Vincent Lefevre @ 2001-06-26 10:10 UTC (permalink / raw)
To: zsh-users
On 26 Jun, Andrej Borsenkow <Andrej.Borsenkow@mow.siemens.ru> wrote:
> I suspect it is part of more general problem. I have a feeling that
> handling of exact match changed at some point near 4.0.1 release. Now zsh
> will prefer exact match in any context while before I got menu selection
> ... and I am sure none of my styles changed.
> E.g. I have /usr/lib{,64s}/netlib. Attempt to complete /u/l/n always
> completes /usr/lib/netlib. Styles are:
But in my case, where soft is a named directory and software is a normal
directory in the cwd, soft shouldn't be seen as an exact match.
And what do you call an exact match? I don't understand your example.
I would agree if you had typed "/u/lib/n". But I don't see why lib
should be priviledged. Because it is shorter than lib64s? But I don't
think this is a good idea.
--
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/> - 100%
validated HTML - Acorn Risc PC, Yellow Pig 17, Championnat International des
Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA
^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: [zsh 4.0.1 bug] filename completion
2001-06-26 10:10 ` Vincent Lefevre
@ 2001-06-26 10:28 ` Andrej Borsenkow
2001-06-26 11:06 ` Vincent Lefevre
0 siblings, 1 reply; 13+ messages in thread
From: Andrej Borsenkow @ 2001-06-26 10:28 UTC (permalink / raw)
To: Vincent Lefevre, zsh-users
>
> On 26 Jun, Andrej Borsenkow <Andrej.Borsenkow@mow.siemens.ru> wrote:
> > I suspect it is part of more general problem. I have a feeling that
> > handling of exact match changed at some point near 4.0.1
> release. Now zsh
> > will prefer exact match in any context while before I got menu selection
> > ... and I am sure none of my styles changed.
>
> > E.g. I have /usr/lib{,64s}/netlib. Attempt to complete /u/l/n always
> > completes /usr/lib/netlib. Styles are:
>
> But in my case, where soft is a named directory and software is a normal
> directory in the cwd, soft shouldn't be seen as an exact match.
>
It is. It makes no difference if one is named directory and other a file as
long as 'cd soft' works. And 'soft' *is* exact match for 'soft'.
> And what do you call an exact match?
It was incorrect term here, you are right. More correct would be "exact
prefix match" ... which is probably even more confusing :-) If one matching
word was exact prefix of others, the other ones were not considered.
I don't understand your
example.
> I would agree if you had typed "/u/lib/n". But I don't see why lib
> should be priviledged. Because it is shorter than lib64s? But I don't
> think this is a good idea.
Erm ... my example was meant for Sven and he got it right :-))) Anyway, my
point was exactly as yours - lib should not be preferred in this context,
but it was, and it was a bug. And it was the reason for a problem you
reported. Sven's patch fixed it and I hope it will be included in 4.0.2.
-andrej
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [zsh 4.0.1 bug] filename completion
2001-06-26 10:28 ` Andrej Borsenkow
@ 2001-06-26 11:06 ` Vincent Lefevre
2001-06-26 11:18 ` Sven Wischnowsky
0 siblings, 1 reply; 13+ messages in thread
From: Vincent Lefevre @ 2001-06-26 11:06 UTC (permalink / raw)
To: zsh-users
On 26 Jun, Andrej Borsenkow <Andrej.Borsenkow@mow.siemens.ru> wrote:
> It is. It makes no difference if one is named directory and other a file as
> long as 'cd soft' works. And 'soft' *is* exact match for 'soft'.
OK, you're right. But then, "cd so" should complete to "cd soft" (and
not "cd software"), then give the choice between "soft" (because it
is a named directory) and "software" (directory in the cwd). In fact,
just like if CD_ABLE_VARS added a special virtual directory to the
cdpath, containing the named directories.
BTW, can I define an alias "c." in such a way that it behaves as if
cdpath were (.), or as "cd ./"?
--
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/> - 100%
validated HTML - Acorn Risc PC, Yellow Pig 17, Championnat International des
Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [zsh 4.0.1 bug] filename completion
2001-06-26 11:06 ` Vincent Lefevre
@ 2001-06-26 11:18 ` Sven Wischnowsky
2001-06-26 13:28 ` Vincent Lefevre
0 siblings, 1 reply; 13+ messages in thread
From: Sven Wischnowsky @ 2001-06-26 11:18 UTC (permalink / raw)
To: zsh-users
Vincent Lefevre wrote:
> On 26 Jun, Andrej Borsenkow <Andrej.Borsenkow@mow.siemens.ru> wrote:
> > It is. It makes no difference if one is named directory and other a file as
> > long as 'cd soft' works. And 'soft' *is* exact match for 'soft'.
>
> OK, you're right. But then, "cd so" should complete to "cd soft" (and
> not "cd software"), then give the choice between "soft" (because it
> is a named directory) and "software" (directory in the cwd). [...]
That's what my patch does.
> BTW, can I define an alias "c." in such a way that it behaves as if
> cdpath were (.), or as "cd ./"?
Something like this:
c.() {
setopt localoptions nocdablevars # if you want that...
local CDPATH
cd $*
}
(Or just use a function that sticks a `./' or `$PWD/' in front of the
first argument and then calls cd if that's enough for you.)
Completion for that:
compdef c.=cd
This says that arguments for `c.' are to be completed as for `cd'.
zstyle ':completion:*:*:c.:*' tag-order local-directories
And this says that you want only local directories (those in `.') to be
completed for `c.'.
Bye
Sven
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [zsh 4.0.1 bug] filename completion
2001-06-26 11:18 ` Sven Wischnowsky
@ 2001-06-26 13:28 ` Vincent Lefevre
2001-06-26 13:29 ` Sven Wischnowsky
0 siblings, 1 reply; 13+ messages in thread
From: Vincent Lefevre @ 2001-06-26 13:28 UTC (permalink / raw)
To: zsh-users
On Tue, Jun 26, 2001 at 13:18:59 +0200, Sven Wischnowsky wrote:
> Something like this:
Thanks.
> c.() {
> setopt localoptions nocdablevars # if you want that...
> local CDPATH
> cd $*
> }
I think I should use "$@" instead of $*.
--
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/> - 100%
validated HTML - Acorn Risc PC, Yellow Pig 17, Championnat International des
Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [zsh 4.0.1 bug] filename completion
2001-06-26 13:28 ` Vincent Lefevre
@ 2001-06-26 13:29 ` Sven Wischnowsky
2001-06-26 13:37 ` Vincent Lefevre
0 siblings, 1 reply; 13+ messages in thread
From: Sven Wischnowsky @ 2001-06-26 13:29 UTC (permalink / raw)
To: zsh-users
Vincent Lefevre wrote:
> On Tue, Jun 26, 2001 at 13:18:59 +0200, Sven Wischnowsky wrote:
> > Something like this:
>
> Thanks.
>
> > c.() {
> > setopt localoptions nocdablevars # if you want that...
> > local CDPATH
> > cd $*
> > }
>
> I think I should use "$@" instead of $*.
In terms of sh/ksh/bash-compatibility, yes. But for zsh it will give
you the same unless you have shwordsplit set.
Bye
Sven
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [zsh 4.0.1 bug] filename completion
2001-06-26 13:29 ` Sven Wischnowsky
@ 2001-06-26 13:37 ` Vincent Lefevre
2001-06-26 13:49 ` Sven Wischnowsky
0 siblings, 1 reply; 13+ messages in thread
From: Vincent Lefevre @ 2001-06-26 13:37 UTC (permalink / raw)
To: zsh-users
On Tue, Jun 26, 2001 at 15:29:30 +0200, Sven Wischnowsky wrote:
> In terms of sh/ksh/bash-compatibility, yes. But for zsh it will give
> you the same unless you have shwordsplit set.
It is currently unset, but I don't want to break my current functions
if I change my mind in the future...
I've just tried your solution and it doesn't work.
greux:~> which c. <15:32:45
c. () {
setopt localoptions nocdablevars
local CDPATH
cd "$@"
}
and I have
compdef c.=cd
zstyle ':completion:*:*:c.:*' tag-order local-directories
at the end of my .zshrc, but when I type "c. soft" and try to complete,
nothing happens.
--
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/> - 100%
validated HTML - Acorn Risc PC, Yellow Pig 17, Championnat International des
Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [zsh 4.0.1 bug] filename completion
2001-06-26 13:37 ` Vincent Lefevre
@ 2001-06-26 13:49 ` Sven Wischnowsky
0 siblings, 0 replies; 13+ messages in thread
From: Sven Wischnowsky @ 2001-06-26 13:49 UTC (permalink / raw)
To: zsh-users
Vincent Lefevre wrote:
> On Tue, Jun 26, 2001 at 15:29:30 +0200, Sven Wischnowsky wrote:
> > In terms of sh/ksh/bash-compatibility, yes. But for zsh it will give
> > you the same unless you have shwordsplit set.
>
> It is currently unset, but I don't want to break my current functions
> if I change my mind in the future...
>
> I've just tried your solution and it doesn't work.
>
> greux:~> which c. <15:32:45
> c. () {
> setopt localoptions nocdablevars
> local CDPATH
> cd "$@"
> }
>
> and I have
>
> compdef c.=cd
> zstyle ':completion:*:*:c.:*' tag-order local-directories
>
> at the end of my .zshrc, but when I type "c. soft" and try to complete,
> nothing happens.
Ouch, right. I hadn't realised that it tries to complete parameters
even if only local-directories are selected.
As a quick fix, you can add a small completion function for `c.', like this:
c. () {
setopt localoptions nocdablevars
local CDPATH
cd "$@"
}
_c.() {
setopt localoptions nocdablevars
local CDPATH
_cd "$@"
}
compdef _c. c.
zstyle ':completion:*:*:c.:*' tag-order local-directories
Note that the compdef line changed.
Whoever wrote that code in _cd should probably start re-thinking it (and
I don't think it was me this time).
Bye
Sven
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2001-06-26 13:52 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-25 23:01 [zsh 4.0.1 bug] filename completion Vincent Lefevre
2001-06-26 5:15 ` Bart Schaefer
2001-06-26 8:35 ` Andrej Borsenkow
2001-06-26 9:01 ` Sven Wischnowsky
2001-06-26 10:10 ` Vincent Lefevre
2001-06-26 10:28 ` Andrej Borsenkow
2001-06-26 11:06 ` Vincent Lefevre
2001-06-26 11:18 ` Sven Wischnowsky
2001-06-26 13:28 ` Vincent Lefevre
2001-06-26 13:29 ` Sven Wischnowsky
2001-06-26 13:37 ` Vincent Lefevre
2001-06-26 13:49 ` Sven Wischnowsky
2001-06-26 9:41 ` Vincent Lefevre
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).