summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2008-09-18 20:35:37 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2008-09-18 20:35:37 +0000
commit1775a6ba81a4f5dbb92fd6c7a34f5cb43703bfb7 (patch)
tree14abe74cd94fae99760703517e032395bdeddc3c
parenta84220930c70cf700cb2870697f59a378ca9390f (diff)
downloadzsh-1775a6ba81a4f5dbb92fd6c7a34f5cb43703bfb7.tar.gz
zsh-1775a6ba81a4f5dbb92fd6c7a34f5cb43703bfb7.zip
25690: fix insert-last-word on multibyte characters with Meta
-rw-r--r--ChangeLog5
-rw-r--r--Src/Zle/zle_hist.c8
2 files changed, 8 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 92e0ed26a..d818348b4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-09-18 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 25690: Src/Zle/zle_hist.c: fix insertlastword not to
+ screw up characters in the history that needed metafication.
+
2008-09-18 Peter Stephenson <pws@csr.com>
* 25684: Src/prompt.c: respect trap line number rules in
diff --git a/Src/Zle/zle_hist.c b/Src/Zle/zle_hist.c
index 85c149929..97b82fdcd 100644
--- a/Src/Zle/zle_hist.c
+++ b/Src/Zle/zle_hist.c
@@ -599,7 +599,7 @@ insertlastword(char **args)
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 @@ insertlastword(char **args)
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 @@ insertlastword(char **args)
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;
}