From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH Re: Problem with completion matching control
Date: Thu, 18 Feb 1999 10:00:12 +0100 (MET) [thread overview]
Message-ID: <199902180900.KAA06759@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: opk@thoth.u-net.com's message of Thu, 18 Feb 1999 01:00:01 +0000
Oliver Kiddle wrote:
> I've just noticed something else regarding matching control with my
> ncftp compctl which uses 'r:|.=* r:|=*' the following happens:
>
> ncftp sunsite.d<tab>
>
> offers
>
> sunsite.auc.dk and sunsite.doc.ic.ac.uk
>
> This is exactly what I would expect from the matching but it isn't quite
> what I want to achieve.
Actually I wanted to give it the behavior you wanted to achieve (so,
in a certain sense, the patch below is a bug fix).
> I've tried a number of things, mostly involving [^.]# in the tpat
> without success. If anyone can work this out, I'd appreciate it - I've
> given up for now because it's getting late.
In both the manual and my original description I took care to say that
this does not support all the patterns known from globbing and the
like. So `[^.]#' just means a non-dot followed by a `#'.
Bye
Sven
--- os/Zle/zle_tricky.c Wed Feb 17 17:30:06 1999
+++ Src/Zle/zle_tricky.c Thu Feb 18 09:55:47 1999
@@ -3238,13 +3238,17 @@
else if (mp->wlen < 0) {
/* This is reached if we have a `*' pattern. */
if ((t = pattern_match(mp->line, l, NULL, NULL))) {
- if (mp->flags & CMF_RIGHT) {
- if (mp->right && ll >= mp->llen + mp->ralen)
- t = pattern_match(mp->right, l + mp->llen,
- NULL, NULL);
- else
- t = 0;
- }
+ if (mp->flags & CMF_RIGHT)
+ /* Check if the anchor matches what's on the
+ * line. If it also matches the word, we don't
+ * use the matcher since we don't want one of
+ * these patterns on the line to match more
+ * than one such sub-string in the word. */
+ t = (mp->right && ll >= mp->llen + mp->ralen &&
+ pattern_match(mp->right, l + mp->llen,
+ NULL, NULL) &&
+ lw >= mp->ralen &&
+ !pattern_match(mp->right, w, NULL, NULL));
if (t) {
/* The anchor matched, so find out how many
* characters are matched by the `*' pattern.
@@ -3467,14 +3471,14 @@
else if (mp->wlen < 0) {
if ((t = pattern_match(mp->line, l - mp->llen,
NULL, NULL))) {
- if (mp->flags & CMF_LEFT) {
- if (mp->left && ll >= mp->llen + mp->lalen)
- t = pattern_match(mp->left,
- l - mp->llen - mp->lalen,
- NULL, NULL);
- else
- t = 0;
- }
+ if (mp->flags & CMF_LEFT)
+ t = (mp->left && ll >= mp->llen + mp->lalen &&
+ pattern_match(mp->left,
+ l - mp->llen - mp->lalen,
+ NULL, NULL) &&
+ lw >= mp->lalen &&
+ !pattern_match(mp->left, w - mp->lalen,
+ NULL, NULL));
if (t) {
int i = 0, j = iw, k = lw;
int jj = il + mp->llen, kk = ll - mp->llen;
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
reply other threads:[~1999-02-18 9:01 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=199902180900.KAA06759@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).