* PATCH: another completion matcher cleanup
@ 1999-02-01 9:01 Sven Wischnowsky
0 siblings, 0 replies; only message in thread
From: Sven Wischnowsky @ 1999-02-01 9:01 UTC (permalink / raw)
To: zsh-workers
The patch below fixes two problems with the completion matching
stuff. Using it for partial-word matching, completing words that
contained consecutive part-separators failed (e.g. `f--<TAB>'). Also,
with partial-word matching the cursor was sometimes left in the wrong
place.
The patch works with a nicely patched pws-5 and with a pws-6.
Bye
Sven
diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- os/Zle/zle_tricky.c Fri Jan 29 15:56:35 1999
+++ Src/Zle/zle_tricky.c Sat Jan 30 16:05:25 1999
@@ -1906,8 +1906,10 @@
while (ll && lw) {
for (ms = mstack; ms; ms = ms->next) {
for (mp = ms->matcher; mp; mp = mp->next) {
- if (nm == mp || lm == mp)
+ if (nm == mp || lm == mp) {
+ nm = NULL;
continue;
+ }
t = 1;
/* Try to match the prefix, if any. */
if (mp->flags & CMF_LEFT) {
@@ -1943,7 +1945,7 @@
NULL, NULL, mp))
break;
}
- if (k) {
+ if (k && i) {
if (nlp) {
nw = addtoword(&rw, &rwlen, nw, mp,
l, w, i, 0);
@@ -2119,8 +2121,10 @@
while (ll && lw) {
for (ms = mstack; ms; ms = ms->next) {
for (mp = ms->matcher; mp; mp = mp->next) {
- if (nm == mp || lm == mp)
+ if (nm == mp || lm == mp) {
+ nm = NULL;
continue;
+ }
t = 1;
if (mp->flags & CMF_RIGHT) {
if (il < mp->ralen || iw < mp->ralen)
@@ -2148,13 +2152,13 @@
if (t) {
int i = 0, j = iw, k = lw;
int jj = il + mp->llen, kk = ll - mp->llen;
- char *p = l - mp->llen, *q = w;
+ char *p = l - mp->llen - 1, *q = w - 1;
for (; k; i++, j++, k--, q--)
- if (match_sfx(p, q, NULL, NULL,
- NULL, mp))
+ if (match_pfx(p, q, NULL, NULL,
+ NULL, NULL, mp))
break;
- if (k) {
+ if (k && i) {
if (nlp) {
nw = addtoword(&rw, &rwlen, nw, mp,
l - mp->llen, w - i,
@@ -2164,10 +2168,10 @@
((mp->flags & CMF_LEFT) ?
CLF_SUF : 0));
}
- w = q;
+ w = q + 1;
iw = j;
lw = k;
- l = p;
+ l = p + 1;
il = jj;
ll = kk;
bc -= i;
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1999-02-01 9:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-02-01 9:01 PATCH: another completion matcher cleanup Sven Wischnowsky
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).