From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: partial word completion
Date: Mon, 17 Apr 2000 09:55:04 +0200 (MET DST) [thread overview]
Message-ID: <200004170755.JAA08001@beta.informatik.hu-berlin.de> (raw)
This could fail terribly with a common suffix and with empty parts.
Bye
Sven
Index: Src/Zle/compmatch.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compmatch.c,v
retrieving revision 1.4
diff -u -r1.4 compmatch.c
--- Src/Zle/compmatch.c 2000/04/07 09:16:37 1.4
+++ Src/Zle/compmatch.c 2000/04/17 07:44:01
@@ -1767,7 +1767,7 @@
free_cline(o);
x = o;
o = tn;
- if (po && cmp_anchors(x, po, 0)) {
+ if (po && po->prefix && cmp_anchors(x, po, 0)) {
po->flags |= CLF_MISS;
po->max += diff;
} else {
@@ -1784,7 +1784,7 @@
if (tn && cmp_anchors(o, tn, 0)) {
diff = sub_join(o, n, tn, 0);
- if (po && cmp_anchors(n, pn, 0)) {
+ if (po && po->prefix && cmp_anchors(n, pn, 0)) {
po->flags |= CLF_MISS;
po->max += diff;
} else {
@@ -1850,7 +1850,7 @@
if (tn) {
diff = sub_join(o, n, tn, 0);
- if (po && cmp_anchors(n, pn, 0)) {
+ if (po && po->prefix && cmp_anchors(n, pn, 0)) {
po->flags |= CLF_MISS;
po->max += diff;
} else {
@@ -1864,19 +1864,21 @@
n = n->next;
continue;
} else {
- for (t = o; (tn = t->next) && !cmp_anchors(n, tn, 1);
- t = tn);
+ Cline to;
- if (tn) {
- diff = sub_join(n, o, tn, 1);
+ for (t = o; (to = t->next) && !cmp_anchors(n, to, 1);
+ t = to);
+ if (to) {
+ diff = sub_join(n, o, to, 1);
+
if (po)
- po->next = tn;
+ po->next = to;
else
- oo = tn;
+ oo = to;
x = o;
- o = tn;
- if (po && cmp_anchors(x, po, 0)) {
+ o = to;
+ if (po && po->prefix && cmp_anchors(x, po, 0)) {
po->flags |= CLF_MISS;
po->max += diff;
} else {
@@ -1885,14 +1887,42 @@
}
continue;
} else {
- if (o->flags & CLF_SUF)
- break;
+ Cline tt = NULL;
- o->word = o->line = o->orig = NULL;
- o->wlen = 0;
- free_cline(o->next);
- o->next = NULL;
- o->flags |= CLF_MISS;
+ for (t = n; (tn = t->next); t = tn) {
+ for (tt = o;
+ (to = tt->next) &&
+ !cmp_anchors(tn, to, 1); tt = to);
+ if (tt)
+ break;
+ }
+ if (tt) {
+ diff = sub_join(n, o, to, 1);
+
+ if (po)
+ po->next = to;
+ else
+ oo = to;
+ x = o;
+ o = to;
+ if (po && po->prefix && cmp_anchors(x, po, 0)) {
+ po->flags |= CLF_MISS;
+ po->max += diff;
+ } else {
+ o->flags |= CLF_MISS;
+ o->max += diff;
+ }
+ continue;
+ } else {
+ if (o->flags & CLF_SUF)
+ break;
+
+ o->word = o->line = o->orig = NULL;
+ o->wlen = 0;
+ free_cline(o->next);
+ o->next = NULL;
+ o->flags |= CLF_MISS;
+ }
}
}
}
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
next reply other threads:[~2000-04-17 7:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-04-17 7:55 Sven Wischnowsky [this message]
-- strict thread matches above, loose matches on Subject: below --
2000-04-18 7:06 Sven Wischnowsky
2000-04-18 1:20 Felix Rosencrantz
2000-04-03 12:17 Sven Wischnowsky
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=200004170755.JAA08001@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).