about summary refs log tree commit diff
path: root/Src/Zle/zle_main.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2016-04-04 14:54:54 +0100
committerPeter Stephenson <pws@zsh.org>2016-04-04 14:54:54 +0100
commit2b7035d974a69d9a47b1f89f868787a4585386a1 (patch)
tree419fb9c926df47a44888ae642866f11764610c84 /Src/Zle/zle_main.c
parentcaff72941d86983b44103653895328b411b29b4e (diff)
downloadzsh-2b7035d974a69d9a47b1f89f868787a4585386a1.tar.gz
zsh-2b7035d974a69d9a47b1f89f868787a4585386a1.tar.xz
zsh-2b7035d974a69d9a47b1f89f868787a4585386a1.zip
38241: ungetkeycmd() needs to unmetafy key string.
Use the new function to simplify memory management in prefix handling.

Third time lucky.
Diffstat (limited to 'Src/Zle/zle_main.c')
-rw-r--r--Src/Zle/zle_main.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index 104e5d6c5..472e326d1 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -357,6 +357,21 @@ ungetbytes(char *s, int len)
 	ungetbyte(*--s);
 }
 
+/**/
+void
+ungetbytes_unmeta(char *s, int len)
+{
+    s += len;
+    while (len--) {
+	if (len && s[-2] == Meta) {
+	    ungetbyte(*--s ^ 32);
+	    len--;
+	    s--;
+	} else
+	    ungetbyte(*--s);
+    }
+}
+
 #if defined(pyr) && defined(HAVE_SELECT)
 static int
 breakread(int fd, char *buf, int n)