From: Wayne Davison <wayne@tenor.clarinet.com>
To: Zoltan Hidvegi <hzoli@cs.elte.hu>
Cc: Zsh hacking and development <zsh-workers@math.gatech.edu>
Subject: Re: Minor change for new isearch code
Date: Tue, 14 May 1996 10:21:48 -0700 [thread overview]
Message-ID: <199605141721.KAA07375@tenor.clari.net> (raw)
In-Reply-To: hzoli's message of Tue, 14 May 1996 05:11:30 +0200. <199605140311.FAA01491@hzoli.ppp.cs.elte.hu>
Zoltan Hidvegi writes:
> Here is a complete revision of the patches in articles 1062 and 1063
> from Wayne.
Fair enough. You missed a couple strlen() -> ztrlen() changes
in the history-search-* functions, however. BUT, since your
new metadiffer() function can differentiate between an exact match
and a substring match, the ztrlen() call isn't even needed if we
disallow the 0 return value. My patch is appended.
This patch also corrects a minor typo in the comment prior to
metadiffer() and moves the assignment of histpos (a trivial
optimization).
..wayne..
---8<------8<------8<------8<---cut here--->8------>8------>8------>8---
Index: utils.c
@@ -2948,7 +2948,7 @@
return 1;
}
-/* Return zero if the metafied string s differs and the non-metafied, *
+/* Return zero if the metafied string s and the non-metafied, *
* len-long string r are the same. Return -1 if r is a prefix of s *
* and return 1 otherwise. */
Index: zle_hist.c
@@ -355,8 +355,8 @@
for (t0 = 0; t0 < ll && !iblank(line[t0]); t0++);
if (t0 < ll)
t0++;
+ histpos = t0;
}
- histpos = t0;
for (;;) {
histline--;
if (!(s = zle_get_event(histline))) {
@@ -364,8 +364,7 @@
histline = ohistline;
return;
}
- if (strlen(UTOSCP(s)) > t0 &&
- metadiffer(s, UTOSCP(line), t0) < 1 &&
+ if (metadiffer(s, UTOSCP(line), t0) < 0 &&
metadiffer(s, UTOSCP(line), ll))
break;
}
@@ -386,8 +385,8 @@
for (t0 = 0; t0 < ll && !iblank(line[t0]); t0++);
if (t0 < ll)
t0++;
+ histpos = t0;
}
- histpos = t0;
for (;;) {
histline++;
if (!(s = zle_get_event(histline))) {
@@ -395,8 +394,7 @@
histline = ohistline;
return;
}
- if ((histline == curhist || strlen(UTOSCP(s)) > t0) &&
- metadiffer(s, UTOSCP(line), t0) < 1 &&
+ if (metadiffer(s, UTOSCP(line), t0) < (histline == curhist) &&
metadiffer(s, UTOSCP(line), ll))
break;
}
@@ -1101,8 +1099,7 @@
histline = ohistline;
return;
}
- if (ztrlen((char *)s) > cs &&
- metadiffer(s, (char *)line, cs) < 1 &&
+ if (metadiffer(s, (char *)line, cs) < 0 &&
metadiffer(s, (char *)line, ll))
break;
}
@@ -1130,8 +1127,7 @@
histline = ohistline;
return;
}
- if ((histline == curhist || ztrlen((char *)s) > cs) &&
- metadiffer(s, (char *)line, cs) < 1 &&
+ if (metadiffer(s, (char *)line, cs) < (histline == curhist) &&
metadiffer(s, (char *)line, ll))
break;
}
---8<------8<------8<------8<---cut here--->8------>8------>8------>8---
prev parent reply other threads:[~1996-05-14 17:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-05-12 18:48 Wayne Davison
1996-05-13 1:12 ` Zoltan Hidvegi
1996-05-13 11:22 ` Wayne Davison
1996-05-14 3:11 ` Zoltan Hidvegi
1996-05-14 17:21 ` Wayne Davison [this message]
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=199605141721.KAA07375@tenor.clari.net \
--to=wayne@tenor.clarinet.com \
--cc=hzoli@cs.elte.hu \
--cc=zsh-workers@math.gatech.edu \
/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).