zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers <zsh-workers@sunsite.dk>
Subject: Re: weird history bug (involves unicode characters)
Date: Thu, 18 Sep 2008 21:33:22 +0100	[thread overview]
Message-ID: <20080918213322.6a3b7c58@pws-pc> (raw)
In-Reply-To: <237967ef0809180515p784beb03ud7a78129089c4e2c@mail.gmail.com>

On Thu, 18 Sep 2008 14:15:12 +0200
"Mikael Magnusson" <mikachu@gmail.com> wrote:
> zsh -f<enter>
> : ト<enter>
> <alt-.>
> #this brings back the ト
> <ctrl-c>
> <uparrow>
> 
> only the colon appears, and alt-. also stops working completely

I can't work out why no one else sees these problems...

I should never have made stringaszleline() modify the string in place.
It was supposed to be more efficient but I keep forgetting.  I should
perhaps make it a flag which should be enough to remind me.

Index: Src/Zle/zle_hist.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_hist.c,v
retrieving revision 1.57
diff -u -r1.57 zle_hist.c
--- Src/Zle/zle_hist.c	11 May 2008 18:37:35 -0000	1.57
+++ Src/Zle/zle_hist.c	18 Sep 2008 20:31:08 -0000
@@ -599,7 +599,7 @@
 
     static char *lastinsert;
     static int lasthist, lastpos, lastlen;
-    int evhist, save;
+    int evhist;
 
     /*
      * If we have at least one argument, the first is the history
@@ -722,10 +722,9 @@
 	t = he->node.nam + he->words[2*n-1];
     }
 
-    save = *t;
-    *t = '\0';			/* ignore trailing whitespace */
     lasthist = evhist;
     lastpos = zlemetacs;
+    /* ignore trailing whitespace */
     lastlen = t - s;
     lastinsert = zalloc(t - s);
     memcpy(lastinsert, s, lastlen);
@@ -734,11 +733,10 @@
 
     unmetafy_line();
 
-    zs = stringaszleline(s, 0, &len, NULL, NULL);
+    zs = stringaszleline(dupstrpfx(s, t - s), 0, &len, NULL, NULL);
     doinsert(zs, len);
     free(zs);
     zmult = n;
-    *t = save;
     return 0;
 }
 

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


  reply	other threads:[~2008-09-18 20:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-18 12:15 Mikael Magnusson
2008-09-18 20:33 ` Peter Stephenson [this message]
2008-09-18 21:27   ` Mikael Magnusson

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=20080918213322.6a3b7c58@pws-pc \
    --to=p.w.stephenson@ntlworld.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).