zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: zsh-workers@zsh.org
Subject: Re: zsh 4.3.10 history-incremental-search-backward freezes in UTF-8
Date: Thu, 18 Mar 2010 15:44:24 +0000	[thread overview]
Message-ID: <20100318154424.706b6c16@news01> (raw)
In-Reply-To: <20100318152056.GO1761@prunille.vinc17.org>

On Thu, 18 Mar 2010 16:20:56 +0100
Vincent Lefevre <vincent@vinc17.net> wrote:
> On 2010-03-18 14:30:20 +0000, Peter Stephenson wrote:
> > I can't think of anything that's changed that would have fixed this (but
> > it's been a long time now and we're due for another releases).  I won't
> > be doing any work on it until I get a reproducible case I can run.  It
> > sounds like it should be fairly trivial to fix if I can find out what
> > (misinterpreted) characters are causing a freeze at what point in the
> > code.
> 
> I think this should be reproducible with shared history file:
> 
> 1. Type in an ISO-8859-1 terminal: echo zzé zz
> 2. In a UTF-8 terminal: history-incremental-search-backward then type z

Yes, I can see that.  All that's really on offer with the wrong character
set is it doesn't hang...

Index: Src/Zle/zle_hist.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_hist.c,v
retrieving revision 1.63
diff -p -u -r1.63 zle_hist.c
--- Src/Zle/zle_hist.c	6 Sep 2009 21:37:14 -0000	1.63
+++ Src/Zle/zle_hist.c	18 Mar 2010 15:42:53 -0000
@@ -1454,6 +1454,8 @@ doisearch(char **args, int dir, int patt
 	    memset(&mbs, 0, sizeof(mbs));
 	    while (charpos < end_pos) {
 		ret = mb_metacharlenconv_r(zlemetaline + charpos, &wc, &mbs);
+		if (ret <= 0) /* Unrecognised, treat as single char */
+		    ret = 1;
 		if (charpos <= pos && pos < charpos + ret)
 		    isearch_startpos = charcount;
 		charcount++;


-- 
Peter Stephenson <pws@csr.com>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom


  reply	other threads:[~2010-03-18 15:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-18 10:50 Vincent Lefevre
2010-03-18 14:30 ` Peter Stephenson
2010-03-18 15:20   ` Vincent Lefevre
2010-03-18 15:44     ` Peter Stephenson [this message]
2010-03-20  0:29       ` PATCH: Displaying invalid characters Peter Stephenson
2010-03-25 16:43       ` zsh 4.3.10 history-incremental-search-backward freezes in UTF-8 Vincent Lefevre
2010-03-18 14:55 ` Bart Schaefer
2010-03-18 15:24   ` Vincent Lefevre

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=20100318154424.706b6c16@news01 \
    --to=pws@csr.com \
    --cc=zsh-workers@zsh.org \
    /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).