about summary refs log tree commit diff
path: root/Src/Zle
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Zle')
-rw-r--r--Src/Zle/zle_hist.c23
-rw-r--r--Src/Zle/zle_keymap.c4
-rw-r--r--Src/Zle/zle_misc.c19
3 files changed, 34 insertions, 12 deletions
diff --git a/Src/Zle/zle_hist.c b/Src/Zle/zle_hist.c
index 7bb5f43a6..f529e7820 100644
--- a/Src/Zle/zle_hist.c
+++ b/Src/Zle/zle_hist.c
@@ -531,10 +531,11 @@ insertlastword(char **args)
 	}
     }
 
+    metafy_line();
     if (lastinsert && lastlen &&
-	lastpos <= zlecs &&
-	lastlen == zlecs - lastpos &&
-	memcmp(lastinsert, (char *)&zleline[lastpos], lastlen) == 0)
+	lastpos <= zlemetacs &&
+	lastlen == zlemetacs - lastpos &&
+	memcmp(lastinsert, (char *)&zlemetaline[lastpos], lastlen) == 0)
 	deleteword = 1;
     else
 	lasthist = curhist;
@@ -548,9 +549,9 @@ insertlastword(char **args)
 	 * confusion.
 	 */
 	if (deleteword) {
-	    int pos = zlecs;
-	    zlecs = lastpos;
-	    foredel(pos - zlecs);
+	    int pos = zlemetacs;
+	    zlemetacs = lastpos;
+	    foredel(pos - zlemetacs);
 	    /*
 	     * Mark that this has been deleted.
 	     * For consistency with history lines, we really ought to
@@ -604,9 +605,9 @@ insertlastword(char **args)
      * successfully found a new one to insert.
      */
     if (deleteword > 0) {
-	int pos = zlecs;
-	zlecs = lastpos;
-	foredel(pos - zlecs);
+	int pos = zlemetacs;
+	zlemetacs = lastpos;
+	foredel(pos - zlemetacs);
     }
     if (lastinsert) {
 	zfree(lastinsert, lastlen);
@@ -625,13 +626,15 @@ insertlastword(char **args)
     save = *t;
     *t = '\0';			/* ignore trailing whitespace */
     lasthist = evhist;
-    lastpos = zlecs;
+    lastpos = zlemetacs;
     lastlen = t - s;
     lastinsert = zalloc(t - s);
     memcpy(lastinsert, s, lastlen);
     n = zmult;
     zmult = 1;
 
+    unmetafy_line();
+
     zs = stringaszleline((unsigned char *)s, 0, &len, NULL, NULL);
     doinsert(zs, len);
     free(zs);
diff --git a/Src/Zle/zle_keymap.c b/Src/Zle/zle_keymap.c
index 9b83a4953..6f4e062fc 100644
--- a/Src/Zle/zle_keymap.c
+++ b/Src/Zle/zle_keymap.c
@@ -818,6 +818,10 @@ bin_bindkey_meta(char *name, char *kmname, Keymap km, UNUSED(char **argv), UNUSE
 	zwarnnam(name, "keymap `%s' is protected", kmname, 0);
 	return 1;
     }
+#ifdef ZLE_UNICODE_SUPPORT
+    zwarnnam(name, "warning: `bindkey -m' disables multibyte support",
+	     NULL, 0);
+#endif
     for(i = 128; i < 256; i++)
 	if(metabind[i - 128] != z_undefinedkey) {
 	    m[0] = i;
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