summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2000-04-17 07:56:25 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2000-04-17 07:56:25 +0000
commit8c474bbcd4c78ec465e7198a0bbb47def78374a8 (patch)
tree5ca1dc0dd9b18b9dfb24290a57b5cad2f3dd89a8
parent5c53fb9500c019d7c0ee553f3daf6c277e6f515a (diff)
downloadzsh-8c474bbcd4c78ec465e7198a0bbb47def78374a8.tar.gz
zsh-8c474bbcd4c78ec465e7198a0bbb47def78374a8.zip
fix for partial word completion with empty parts and common suffix (10774)
-rw-r--r--ChangeLog5
-rw-r--r--Src/Zle/compmatch.c66
2 files changed, 53 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index 0568efd49..69a521487 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2000-04-17 Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
+
+ * 10774: Src/Zle/compmatch.c: fix for partial word completion with
+ empty parts and common suffix
+
2000-04-16 Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
* 10771: Etc/MACHINES: successful compilation on OpenBSD, from
diff --git a/Src/Zle/compmatch.c b/Src/Zle/compmatch.c
index 00072b0ee..f0e5a7c47 100644
--- a/Src/Zle/compmatch.c
+++ b/Src/Zle/compmatch.c
@@ -1767,7 +1767,7 @@ join_clines(Cline o, Cline n)
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 @@ join_clines(Cline o, Cline n)
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 @@ join_clines(Cline o, Cline n)
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 @@ join_clines(Cline o, Cline n)
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 @@ join_clines(Cline o, Cline n)
}
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;
+ }
}
}
}