* Re: Multipart completion problem?
@ 1999-03-23 12:35 Sven Wischnowsky
0 siblings, 0 replies; 3+ messages in thread
From: Sven Wischnowsky @ 1999-03-23 12:35 UTC (permalink / raw)
To: zsh-workers
Andrej Borsenkow wrote:
> With all post-pws-13 patches
>
> bor@itsrm2:/tools/src/zsh-3.1.5-pws-13%> zsh -f
> itsrm2% fpath=($PWD/Completion/*(/))
> itsrm2% . Completion/Core/compinit
> itsrm2% ./configure --pre=/toTAB
> itsrm2% ./configure --prefix=to
>
> Where is the slash?
Hey, I could immediatly reproduce that ;-)
The missing slash was caused by a incomplete pattern when weeding out
the names not matching what's on the line. And in another place the
same could cause problems. Finally the test if the string didn't
change had problems when the string from the line contained a trailing
slash.
And then I realised that this is a case where there is non-path
ignored prefix where the code in `do_single()' failed -- something I
foresaw yesterday, but couldn't immediatly come up with an example for
(in my big patch I had only looked at `do_ambiguous()' because I
didn't need to change `do_single()'). So the patch also cleans that --
rather drastically.
Bye
Sven
diff -u -r oc/Core/_path_files Completion/Core/_path_files
--- oc/Core/_path_files Tue Mar 23 11:56:57 1999
+++ Completion/Core/_path_files Tue Mar 23 13:27:02 1999
@@ -239,7 +239,7 @@
# to `donepath'.
while [[ "$orig" = */* ]] do
- tmp1=( $realpath$donepath${orig%%/*}/${~matchflags}${~patstr#*/}$^pats )
+ tmp1=( $realpath$donepath${orig%%/*}/${~matchflags}${~patstr#*/}${^~pats} )
tmp1=("${(@M)tmp1:#$~patlast}")
[[ $#tmp1 -gt 0 && -e "$realpath$donepath${orig%%/*}" ]] || break
donepath="$donepath${orig%%/*}/"
@@ -424,7 +424,7 @@
suffixes=( $str$^pats )
suffixes=( "${(@)suffixes:gs.**.*.}" )
tmp2=( ${~tmp1}${~matchflags}${~suffixes} )
- tmp2=("${(@M)tmp2:#$~patlast}")
+ tmp2=("${(@M)tmp2:#${tmp1}$~patlast}")
if [[ $#tmp2 -eq 0 ]]; then
# No match, insert the expanded path and add the original tail.
@@ -434,7 +434,7 @@
[[ -n "$ostr" && -n "$linepath$testpath" ]] && ostr="/$ostr"
# But only if something changed.
- [[ "$linepath$testpath$ostr" = "$PREFIX$SUFFIX" ]] && return 1
+ [[ "${PREFIX}${SUFFIX}" = $linepath$testpath$ostr(|/) ]] && return 1
compadd -QU -S '' "$group[@]" "$expl[@]" \
-i "$IPREFIX" -I "$ISUFFIX" -f - "$linepath${testpath:q}$ostr"
diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- os/Zle/zle_tricky.c Tue Mar 23 11:57:08 1999
+++ Src/Zle/zle_tricky.c Tue Mar 23 13:06:48 1999
@@ -6766,38 +6766,10 @@
char *p;
/* Build the path name. */
- if (haspattern || ic || m->ripre) {
- int ne = noerrs;
+ p = (char *) zhalloc(strlen(prpre) + strlen(str) +
+ strlen(psuf) + 3);
+ sprintf(p, "%s%s%s", (prpre && *prpre) ? prpre : "./", str, psuf);
- noerrs = 1;
-
- if (m->ripre) {
- int pl = strlen(m->ripre);
-
- p = (char *) zhalloc(pl + strlen(str) + strlen(psuf) + 1);
- sprintf(p, "%s%s%s", m->ripre, str, psuf);
- if (pl && p[pl-1] == Inbrace)
- strcpy(p+pl-1, p+pl);
- } else if (ic) {
- p = (char *) zhalloc(strlen(prpre) + strlen(str) +
- strlen(psuf) + 2);
- sprintf(p, "%c%s%s%s", ic, prpre, str, psuf);
- } else {
- p = (char *) zhalloc(strlen(prpre) + strlen(str) +
- strlen(psuf) + 1);
- sprintf(p, "%s%s%s", prpre, str, psuf);
- }
- parsestr(p);
- if (ic)
- *p = ic;
- singsub(&p);
-
- noerrs = ne;
- } else {
- p = (char *) zhalloc(strlen(prpre) + strlen(str) +
- strlen(psuf) + 3);
- sprintf(p, "%s%s%s", (prpre && *prpre) ? prpre : "./", str, psuf);
- }
/* And do the stat. */
if (!(sr = ztat(p, &buf, 0)) && S_ISDIR(buf.st_mode)) {
/* It is a directory, so add the slash. */
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Multipart completion problem?
@ 1999-03-23 12:48 Sven Wischnowsky
0 siblings, 0 replies; 3+ messages in thread
From: Sven Wischnowsky @ 1999-03-23 12:48 UTC (permalink / raw)
To: zsh-workers
I wrote:
> ...
>
> The missing slash was caused by a incomplete pattern when weeding out
> the names not matching what's on the line.
The test I just added was too restrictive, sorry folks.
Bye
Sven
diff -u oc/Core/_path_files Completion/Core/_path_files
--- oc/Core/_path_files Tue Mar 23 13:36:24 1999
+++ Completion/Core/_path_files Tue Mar 23 13:47:14 1999
@@ -424,7 +424,7 @@
suffixes=( $str$^pats )
suffixes=( "${(@)suffixes:gs.**.*.}" )
tmp2=( ${~tmp1}${~matchflags}${~suffixes} )
- tmp2=("${(@M)tmp2:#${tmp1}$~patlast}")
+ tmp2=("${(@M)tmp2:#*$~patlast}")
if [[ $#tmp2 -eq 0 ]]; then
# No match, insert the expanded path and add the original tail.
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 3+ messages in thread
* Multipart completion problem?
@ 1999-03-23 11:38 Andrej Borsenkow
0 siblings, 0 replies; 3+ messages in thread
From: Andrej Borsenkow @ 1999-03-23 11:38 UTC (permalink / raw)
To: ZSH workers mailing list
With all post-pws-13 patches
bor@itsrm2:/tools/src/zsh-3.1.5-pws-13%> zsh -f
itsrm2% fpath=($PWD/Completion/*(/))
itsrm2% . Completion/Core/compinit
itsrm2% ./configure --pre=/toTAB
itsrm2% ./configure --prefix=to
Where is the slash?
It happened already in pws-12 after some patches ...
Just to avoid questions :-)
itsrm2% ls -d /to*
/tools
cheers
/andrej
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1999-03-23 12:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-03-23 12:35 Multipart completion problem? Sven Wischnowsky
-- strict thread matches above, loose matches on Subject: below --
1999-03-23 12:48 Sven Wischnowsky
1999-03-23 11:38 Andrej Borsenkow
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).