zsh-workers
 help / color / mirror / code / Atom feed
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: Fri, 6 Feb 2004 08:57:09 -0800	[thread overview]
Message-ID: <20040206165709.GB6749@blorf.net> (raw)
In-Reply-To: <20040105170850.GB4482@blorf.net>

[-- Attachment #1: Type: text/plain, Size: 283 bytes --]

On Mon, Jan 05, 2004 at 09:08:50AM -0800, Wayne Davison wrote:
> I think it would be more optimal to sanity-check the last value after
> the loop finishes, like this (untested):

Attached is a patch that should actually work (unlike the previous one).
See if you like it.

..wayne..

[-- Attachment #2: meta.patch --]
[-- Type: text/plain, Size: 982 bytes --]

--- Src/Zle/compmatch.c	20 Jan 2004 10:55:28 -0000	1.39
+++ Src/Zle/compmatch.c	6 Feb 2004 16:46:42 -0000
@@ -1585,16 +1585,18 @@ sub_match(Cmdata md, char *str, int len,
 	    return ret;
 
 	/*
-	 * Look for a common prefix.  Be careful not to include
-	 * a widowed Meta in the prefix.  If we do include metafied
+	 * Look for a common prefix.  If we do include metafied
 	 * characters, at this stage we still need the overall length
 	 * including Meta's as separate characters.
 	 */
 	for (l = 0, p = str, q = md->str;
-	     l < len && l < md->len && p[ind] == q[ind]
-		 && (p[ind] != Meta || p[ind+1] == q[ind+1]);
-	     l++, p += add, q += add);
+	     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--;
 	if (l) {
 	    /* There was a common prefix, use it. */
 	    md->len -= l; len -= l;

  reply	other threads:[~2004-02-06 16:57 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 [this message]
2004-02-06 19:03         ` Bart Schaefer
2004-02-09 22:34         ` Wayne Davison
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=20040206165709.GB6749@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).