* RE: PATCH: Re: pws-10 RE: zsh-3.1.5-pws-9: _path_files and symbolic links
@ 1999-03-01 14:45 Sven Wischnowsky
1999-03-04 17:38 ` Shuld it be so? " Andrej Borsenkow
0 siblings, 1 reply; 2+ messages in thread
From: Sven Wischnowsky @ 1999-03-01 14:45 UTC (permalink / raw)
To: zsh-workers
Andrej Borsenkow wrote:
> > The question is what one can find under `/u/'. If there is anything
> > matching `l/l/T' the behavior might be correct (since it can't expand
> > `u' to `usr' then).
>
> Nope. It is the problem of exact match. ``/u'' is matched _exactly_ and
> hence ``/usr'' is never even tried.
Ah, tricky. The patch below makes path components be left unchanged
only if the rest of the string would produce a match below that
directory.
Bye
Sven
diff -u oc/Core/_path_files Completion/Core/_path_files
--- oc/Core/_path_files Mon Mar 1 14:32:16 1999
+++ Completion/Core/_path_files Mon Mar 1 15:45:51 1999
@@ -170,23 +170,26 @@
fi
fi
-# First we skip over all pathname components in `str' which really exist in
-# the file-system, so that `/usr/lib/l<TAB>' doesn't offer you `lib' and
-# `lib5'. Pathname components skipped this way are taken from `str' and added
-# to `donepath'.
-
-while [[ "$str" = */* ]] do
- [[ -e "$realpath$donepath${str%%/*}" ]] || break
- donepath="$donepath${str%%/*}/"
- str="${str#*/}"
-done
-
+# Save the original string.
orig="${str:s/*//}"
# Now build the glob pattern by calling `_match_pattern'.
patstr="$str"
matchflags=""
_match_pattern _path_files patstr matchflags
+
+# First we skip over all pathname components in `str' which really exist in
+# the file-system, so that `/usr/lib/l<TAB>' doesn't offer you `lib' and
+# `lib5'. Pathname components skipped this way are taken from `orig' and added
+# to `donepath'.
+
+while [[ "$orig" = */* ]] do
+ tmp1=($realpath$donepath${orig%%/*}/${~patstr#*/})
+ [[ $#tmp1 -gt 0 && -e "$realpath$donepath${orig%%/*}" ]] || break
+ donepath="$donepath${orig%%/*}/"
+ orig="${orig#*/}"
+ patstr="${patstr#*/}"
+done
# We almost expect the pattern to have changed `..' into `*.*.', `/.' into
# `/*.', and probably to contain two or more consecutive `*'s. Since these
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 2+ messages in thread
* Shuld it be so? RE: PATCH: Re: pws-10 RE: zsh-3.1.5-pws-9: _path_files and symbolic links
1999-03-01 14:45 PATCH: Re: pws-10 RE: zsh-3.1.5-pws-9: _path_files and symbolic links Sven Wischnowsky
@ 1999-03-04 17:38 ` Andrej Borsenkow
0 siblings, 0 replies; 2+ messages in thread
From: Andrej Borsenkow @ 1999-03-04 17:38 UTC (permalink / raw)
To: Sven Wischnowsky, zsh-workers
>
> Andrej Borsenkow wrote:
>
> > > The question is what one can find under `/u/'. If there is anything
> > > matching `l/l/T' the behavior might be correct (since it can't expand
> > > `u' to `usr' then).
> >
> > Nope. It is the problem of exact match. ``/u'' is matched _exactly_ and
> > hence ``/usr'' is never even tried.
>
> Ah, tricky. The patch below makes path components be left unchanged
> only if the rest of the string would produce a match below that
> directory.
>
(all patches applied):
bor@itsrm2:~%> l /u/l/m<TAB>
bor@itsrm2:~%> l /u1/lager-db/minileit.dbs/
u1/ usr/
^^^^^^^^^^ Somewhat strange. We really have /usr/lib/macros (and more), but
this list is a bit unexpected (well, at least I would expect then to first
menu complete ``/u1'' and ``/usr'' and then go on respectively)
And one more:
bor@itsrm2:~%> l /u/l/lib*X*<TAB>
B-e-e-p
Is it not possible to complete glob patterns?
bor@itsrm2:~%> l -d ~/s*
/home/bor/save/ /home/bor/src/
bor@itsrm2:~%> l /h/b/s*<TAB>
bor@itsrm2:~%> l /home/bor/s\*
but
bor@itsrm2:~%> l /h/b/s/*<TAB>
bor@itsrm2:~%> l /home/bor/save/*
save/ src/
the list is correct - it cycles through ``svae'' and ``src''
puzzled
/andrej
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1999-03-04 17:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-03-01 14:45 PATCH: Re: pws-10 RE: zsh-3.1.5-pws-9: _path_files and symbolic links Sven Wischnowsky
1999-03-04 17:38 ` Shuld it be so? " 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).