Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: weird history bug (involves unicode characters)



On Thu, 18 Sep 2008 14:15:12 +0200
"Mikael Magnusson" <mikachu@xxxxxxxxx> 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@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



Messages sorted by: Reverse Date, Date, Thread, Author