about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--Src/Zle/zle_tricky.c3
2 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 4fe1f9422..b81522315 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2013-08-08  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
+	* Src/Zle/zle_tricky.c (inststrlen): 31644: the wrong length was
+	used when inserting multibyte characters from a string from
+	outside ZLE into the editing buffer.
+
 	* users/17908: Src/hist.c Src/Zle/zle_main.c Src/zsh.h: if
 	modifying history with ZLE active, keep the history line
 	recorded in ZLE in sync.
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index 610055c64..e30e0b1aa 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -2136,8 +2136,8 @@ inststrlen(char *str, int move, int len)
 	return 0;
     if (len == -1)
 	len = strlen(str);
-    spaceinline(len);
     if (zlemetaline != NULL) {
+	spaceinline(len);
 	strncpy(zlemetaline + zlemetacs, str, len);
 	if (move)
 	    zlemetacs += len;
@@ -2148,6 +2148,7 @@ inststrlen(char *str, int move, int len)
 
 	instr = ztrduppfx(str, len);
 	zlestr = stringaszleline(instr, 0, &zlelen, NULL, NULL);
+	spaceinline(zlelen);
 	ZS_strncpy(zleline + zlecs, zlestr, zlelen);
 	free(zlestr);
 	zsfree(instr);