about summary refs log tree commit diff
path: root/Src/Zle/zle_misc.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2005-08-15 10:01:47 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2005-08-15 10:01:47 +0000
commit243539fa30b49d6e9f6c6a39257b35a9e2b70044 (patch)
treebab07ee16f6a8b1fe7db42cb5d5163156248a46d /Src/Zle/zle_misc.c
parent76364d31193ae8cd87a2e92cf2dfe3fb1601fc02 (diff)
downloadzsh-243539fa30b49d6e9f6c6a39257b35a9e2b70044.tar.gz
zsh-243539fa30b49d6e9f6c6a39257b35a9e2b70044.tar.xz
zsh-243539fa30b49d6e9f6c6a39257b35a9e2b70044.zip
21610: Turn on ZLE_UNICODE_SUPPORT and fix a few related problems.
Diffstat (limited to 'Src/Zle/zle_misc.c')
-rw-r--r--Src/Zle/zle_misc.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/Src/Zle/zle_misc.c b/Src/Zle/zle_misc.c
index 9ade372b1..58345ac05 100644
--- a/Src/Zle/zle_misc.c
+++ b/Src/Zle/zle_misc.c
@@ -30,7 +30,7 @@
 #include "zle.mdh"
 #include "zle_misc.pro"
 
-/* insert a metafied string, with repetition and suffix removal */
+/* insert a zle string, with repetition and suffix removal */
 
 /**/
 void
@@ -1107,6 +1107,18 @@ iremovesuffix(ZLE_CHAR_T c, int keep)
 	    LinkList args = newlinklist();
 	    char buf[20];
 	    int osc = sfcontext;
+	    int wasmeta = (zlemetaline != 0);
+
+	    if (wasmeta) {
+		/*
+		 * The suffix removal function runs as a normal
+		 * ZLE function, not a completion function, so
+		 * the line should be unmetafied if this was
+		 * called from completion.  (It may not be since
+		 * we may decide to remove the suffix later.)
+		 */
+		umetafy_line();
+	    }
 
 	    sprintf(buf, "%d", suffixlen[0]);
 	    addlinknode(args, suffixfunc);
@@ -1118,13 +1130,16 @@ iremovesuffix(ZLE_CHAR_T c, int keep)
 	    doshfunc(suffixfunc, prog, args, 0, 1);
 	    sfcontext = osc;
 	    endparamscope();
+
+	    if (wasmeta)
+		metafy_line();
 	}
 	zsfree(suffixfunc);
 	suffixfunc = NULL;
     } else {
 #ifdef ZLE_UNICODE_SUPPORT
 	/* TODO: best I can think of for now... */
-	int sl = (unsigned int)c < 256 ? suffixlen[c] : 0;
+	int sl = (unsigned int)c <= 256 ? suffixlen[c] : 0;
 #else
 	int sl = suffixlen[c];
 #endif