summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2013-08-08 20:10:06 +0100
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2013-08-08 20:10:06 +0100
commit8ae8fae4001873515c2465ca05b8ac77a35a72e5 (patch)
tree376c0f5fa113b9c9a0191319e10c8e309ddaa5e2
parent0b185e3dcd7348045787b972a80d62da4ca0c79f (diff)
downloadzsh-8ae8fae4001873515c2465ca05b8ac77a35a72e5.tar.gz
zsh-8ae8fae4001873515c2465ca05b8ac77a35a72e5.zip
31644: Fix insertion of multibyte characters into editor line.
This was broken for a string that came from outside ZLE in the case where the editing buffer wasn't metafied, i.e. not in completion.
-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);