Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: zsh crashes on completeion of utf-8 file-names.
- X-seq: zsh-workers 19410
- From: Wayne Davison <wayned@xxxxxxxxxxxxxxxxxxxxx>
- To: Peter Stephenson <pws@xxxxxxx>
- Subject: Re: zsh crashes on completeion of utf-8 file-names.
- Date: Mon, 9 Feb 2004 14:34:40 -0800
- Cc: Zsh hackers list <zsh-workers@xxxxxxxxxx>
- In-reply-to: <20040206165709.GB6749@xxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <7460.1073312227@xxxxxxx> <11091.1073318874@xxxxxxx> <20040105170850.GB4482@xxxxxxxxx> <20040206165709.GB6749@xxxxxxxxx>
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..
--- 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;
Messages sorted by:
Reverse Date,
Date,
Thread,
Author