From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: another completion matcher cleanup
Date: Mon, 1 Feb 1999 10:01:10 +0100 (MET) [thread overview]
Message-ID: <199902010901.KAA06905@beta.informatik.hu-berlin.de> (raw)
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
reply other threads:[~1999-02-01 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=199902010901.KAA06905@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).