From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: Re: BUG: Matching cause character to be deleted.
Date: Wed, 26 Apr 2000 08:32:54 +0200 (MET DST) [thread overview]
Message-ID: <200004260632.IAA09728@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Felix Rosencrantz's message of Thu, 20 Apr 2000 17:47:58 -0700 (PDT)
Felix Rosencrantz wrote:
> ...
>
> I found this bug, which is pruned down.
>
> myprompt@ zsh -f
> host% mkdir j
> host% touch j/{BW,UWB,W}
> host% bindkey -e; autoload -U compinit; compinit -D
> host% zstyle ':completion:*:complete:*' matcher-list 'r:|[A-Z0-9]=*'
> host% ls j/W<TAB> #Tab deletes the W, so the line looks like this:
> host% ls j/
Here is the fix. The main problem was that it didn't correctly mark
the cline structs for which there was something on the line (in
particular: the cline structs for the `W').
And then I made merging two cline lists a bit cleverer, trying harder
to find corresponding elements.
Bye
Sven
Index: Src/Zle/compmatch.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compmatch.c,v
retrieving revision 1.6
diff -u -r1.6 compmatch.c
--- Src/Zle/compmatch.c 2000/04/18 07:07:30 1.6
+++ Src/Zle/compmatch.c 2000/04/26 06:29:44
@@ -1018,7 +1018,7 @@
* is set if the characters before the anchor were not
* on the line. */
*q = n = get_cline(NULL, mp->ralen, str, mp->ralen, NULL, 0,
- ((plen < 0) ? CLF_NEW : 0));
+ ((plen <= 0) ? CLF_NEW : 0));
/* If there were any characters before the anchor, add
* them as a cline struct. */
@@ -1046,7 +1046,7 @@
}
/* This is the cline struct for the remaining string at the end. */
- *q = n = get_cline(NULL, 0, NULL, 0, NULL, 0, (plen < 0 ? CLF_NEW : 0));
+ *q = n = get_cline(NULL, 0, NULL, 0, NULL, 0, (plen <= 0 ? CLF_NEW : 0));
if (p != str) {
int olen = str - p, llen = (op < 0 ? 0 : op);
@@ -1843,9 +1843,25 @@
}
/* Now see if they have matching anchors. If not, cut the list. */
if (!(o->flags & CLF_MID) && !cmp_anchors(o, n, 1)) {
- Cline t, tn;
+ Cline t, tn, tt, to = NULL;
- for (t = n; (tn = t->next) && !cmp_anchors(o, tn, 1); t = tn);
+ for (t = n; (tn = t->next); t = tn)
+ if (!(tn->flags & CLF_NEW)) {
+ for (tt = o; (to = tt->next); tt = to)
+ if (!(to->flags & CLF_NEW) &&
+ cmp_anchors(tn, to, 1))
+ break;
+ if (to)
+ break;
+ }
+ if (tn) {
+ if (po)
+ po->next = to;
+ else
+ oo = to;
+ o = to;
+ } else
+ for (t = n; (tn = t->next) && !cmp_anchors(o, tn, 1); t = tn);
if (tn) {
diff = sub_join(o, n, tn, 0);
@@ -1864,8 +1880,6 @@
n = n->next;
continue;
} else {
- Cline to;
-
for (t = o; (to = t->next) && !cmp_anchors(n, to, 1);
t = to);
@@ -1887,9 +1901,7 @@
}
continue;
} else {
- Cline tt = NULL;
-
- for (t = n; (tn = t->next); t = tn) {
+ for (tt = NULL, t = n; (tn = t->next); t = tn) {
for (tt = o;
(to = tt->next) &&
!cmp_anchors(tn, to, 1); tt = to);
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
reply other threads:[~2000-04-26 6:33 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=200004260632.IAA09728@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).