From: Wayne Davison <wayned@users.sourceforge.net>
To: Peter Stephenson <pws@csr.com>
Cc: Zsh hackers list <zsh-workers@sunsite.dk>
Subject: Re: zsh crashes on completeion of utf-8 file-names.
Date: Mon, 9 Feb 2004 14:34:40 -0800 [thread overview]
Message-ID: <20040209223440.GE958@blorf.net> (raw)
In-Reply-To: <20040206165709.GB6749@blorf.net>
[-- Attachment #1: Type: text/plain, Size: 475 bytes --]
I was thinking about the case of the reverse scan, and it occurred to me
that if the character that followed the Meta matched a normal character
in the other string, a reverse scan could end up in the middle of a meta
sequence. This patch fixes this. Note that this code depends on the
(apparent) fact that a meta char cannot be followed by the same value
(e.g. we must be sure that when we see a meta value, it is the start of
a meta sequence and not the end).
..wayne..
[-- Attachment #2: meta.patch --]
[-- Type: text/plain, Size: 706 bytes --]
--- compmatch.c 9 Feb 2004 05:49:52 -0000 1.40
+++ compmatch.c 9 Feb 2004 22:03:27 -0000
@@ -1593,10 +1593,15 @@ sub_match(Cmdata md, char *str, int len,
l < len && l < md->len && p[ind] == q[ind];
l++, p += add, q += add) {}
- /* Make sure we don't end with a widowed Meta (which can only
- * happen in a forward scan). */
- if (l && add == 1 && p[-1] == Meta)
- l--;
+ /* Make sure we don't end in the middle of a Meta sequence. */
+ if (add = 1) {
+ if (l && p[-1] == Meta)
+ l--;
+ } else {
+ if (l && ((l < len && p[-1] == Meta)
+ || (l < md->len && q[-1] == Meta)))
+ l--;
+ }
if (l) {
/* There was a common prefix, use it. */
md->len -= l; len -= l;
next prev parent reply other threads:[~2004-02-09 22:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-21 14:44 Zvi Har'El
2004-01-05 14:17 ` Peter Stephenson
2004-01-05 16:07 ` Peter Stephenson
2004-01-05 17:08 ` Wayne Davison
2004-02-06 16:57 ` Wayne Davison
2004-02-06 19:03 ` Bart Schaefer
2004-02-09 22:34 ` Wayne Davison [this message]
2004-02-09 22:36 ` Wayne Davison
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=20040209223440.GE958@blorf.net \
--to=wayned@users.sourceforge.net \
--cc=pws@csr.com \
--cc=zsh-workers@sunsite.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).