From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: PATCH: Re: _match still does not work in _path_files
Date: Mon, 18 Oct 1999 13:19:09 +0200 (MET DST) [thread overview]
Message-ID: <199910181119.NAA26491@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: "Bart Schaefer"'s message of Mon, 18 Oct 1999 09:50:51 +0000
Bart Schaefer wrote:
> On Oct 18, 10:38am, Sven Wischnowsky wrote:
> } Subject: RE: PATCH: Re: _match still does not work in _path_files
> }
> } The patch below implements some kind of mixed-matching style. Even
> } with glob-complete behaviour it will try to match the prefix using the
> } match specs currently in effect. This is as far as we can get. Is it
> } enough?
>
> There's still one thing that bothers me; it's probably not related. With
> the default compconfig:
>
> zagzig% cd /u/l/s/z/f/
>
> Fails to complete to /usr/local/share/zsh/functions/. The problem is
> that _path_files wants there to be something after the final slash that
> is a fragment of a directory name. I vaguely recall some discussion of
> a compconfig for something like this, but if there is one I can't find
> it -- and given that "cd" doesn't care if the trailing slash is there,
> shouldn't this work by default anyway?
This is one of the cases for `path_expand=prefix', but I agree that it
should be cleverer in doing the right thing automatically.
This makes `_path_files' automatically complete such a path even if
there are no files matching the pattern inside the last directory.
However, it keeps the behaviour of tking the trailing slash as a sign
that one wants to complete inside the directory. I.e. if there *are*
files matching in it, they are added as possible matches immediately.
Ok?
This also made me find some small bugs in the C-code. My last change
to the unambiguous-string insertion heuristic was a bit too eager to
avoid inserting a trailing part. If it was on the line, it should of
course be kept.
And then a rather weird one. Weird in the sense that I wonder why we
haven't noticed it yet. If you add a match as a filename and that's
the name of a directory, do_single() makes the test if it should
append a slash automatically. But if the name added already contains
that trailing slash, it still does the test -- leaving you with two
slashes at the end.
Bye
Sven
diff -u -r oldsrc/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- oldsrc/Zle/zle_tricky.c Mon Oct 18 11:54:06 1999
+++ Src/Zle/zle_tricky.c Mon Oct 18 13:01:58 1999
@@ -7835,7 +7835,7 @@
q = p;
}
if (!e && q && !q->orig && !q->olen && (q->flags & CLF_MISS) &&
- (q->word ? q->wlen : q->llen) < 3) {
+ !(q->flags & CLF_MATCHED) && (q->word ? q->wlen : q->llen) < 3) {
q->word = q->line = NULL;
q->wlen = q->llen = 0;
}
@@ -8452,7 +8452,8 @@
if (m->flags & CMF_PARNEST)
havesuff = 1;
}
- if ((m->flags & CMF_FILE) || (partest && isset(AUTOPARAMSLASH))) {
+ if (((m->flags & CMF_FILE) || (partest && isset(AUTOPARAMSLASH))) &&
+ cs > 0 && line[cs - 1] != '/') {
/* If we have a filename or we completed a parameter name *
* and AUTO_PARAM_SLASH is set, lets see if it is a directory. *
* If it is, we append a slash. */
diff -u -r oldcompletion/Core/_path_files Completion/Core/_path_files
--- oldcompletion/Core/_path_files Mon Oct 18 11:17:49 1999
+++ Completion/Core/_path_files Mon Oct 18 13:10:14 1999
@@ -277,7 +277,12 @@
# otherwise this would keep `_files' from completing all filenames
# if none of the patterns match.
- if [[ "$haspats" = no && -z "$tpre$tsuf" &&
+ if [[ -z "$tpre$tsuf" ]]; then
+ tmp1=( "$tmp2[@]" )
+ addsfx=(-S '')
+ remsfx=()
+ break;
+ elif [[ "$haspats" = no && -z "$tpre$tsuf" &&
"$pre" = */ && -z "$suf" ]]; then
PREFIX="${opre}${osuf}"
SUFFIX=""
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
next reply other threads:[~1999-10-18 11:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-10-18 11:19 Sven Wischnowsky [this message]
-- strict thread matches above, loose matches on Subject: below --
1999-11-02 14:54 Sven Wischnowsky
1999-10-18 8:41 Sven Wischnowsky
1999-10-18 8:38 Sven Wischnowsky
1999-10-18 9:50 ` Bart Schaefer
1999-11-02 14:17 ` Andrej Borsenkow
1999-10-15 14:13 Sven Wischnowsky
1999-10-15 14:26 ` Andrej Borsenkow
1999-10-16 11:46 ` Andrej Borsenkow
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199910181119.NAA26491@beta.informatik.hu-berlin.de \
--to=wischnow@informatik.hu-berlin.de \
--cc=zsh-workers@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).