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/complist.c2
-rw-r--r--Src/Zle/compresult.c13
-rw-r--r--Src/Zle/zle_main.c1
-rw-r--r--Src/Zle/zle_utils.c36
4 files changed, 32 insertions, 20 deletions
diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c
index 1152dff7c..90ea31f66 100644
--- a/Src/Zle/complist.c
+++ b/Src/Zle/complist.c
@@ -2295,6 +2295,8 @@ domenuselect(Hookdef dummy, Chdata dat)
     mlbeg = 0;
     molbeg = -42;
     for (;;) {
+	METACHECK();
+
     	mtab_been_reallocated = 0;
 	if (mline < 0) {
 	    int x, y;
diff --git a/Src/Zle/compresult.c b/Src/Zle/compresult.c
index 43dce9276..ebfb2cc47 100644
--- a/Src/Zle/compresult.c
+++ b/Src/Zle/compresult.c
@@ -1225,6 +1225,8 @@ do_menucmp(int lst)
 int
 reverse_menu(UNUSED(Hookdef dummy), UNUSED(void *dummy2))
 {
+    int was_meta;
+
     do {
 	if (minfo.cur == (minfo.group)->matches) {
 	    do {
@@ -1239,9 +1241,16 @@ reverse_menu(UNUSED(Hookdef dummy), UNUSED(void *dummy2))
 	     ((*minfo.cur)->flags & CMF_DUMMY) ||
 	     (((*minfo.cur)->flags & (CMF_NOLIST | CMF_MULT)) &&
 	      (!(*minfo.cur)->str || !*(*minfo.cur)->str)));
-    metafy_line();
+    /* May already be metafied if called from within a selection */
+    if (zlemetaline == NULL) {
+	metafy_line();
+	was_meta = 0;
+    }
+    else
+	was_meta = 1;
     do_single(*(minfo.cur));
-    unmetafy_line();
+    if (!was_meta)
+	unmetafy_line();
 
     return 0;
 }
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index 7aa0948ad..d8cbcb645 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -996,6 +996,7 @@ zlecore(void)
      * that explicitly.
      */
     while (!done && !errflag && !exit_pending) {
+	UNMETACHECK();
 
 	statusline = NULL;
 	vilinerange = 0;
diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c
index 67c7379f5..9b769b5a0 100644
--- a/Src/Zle/zle_utils.c
+++ b/Src/Zle/zle_utils.c
@@ -943,25 +943,25 @@ handleundo(void)
 	remetafy = 0;
 
     mkundoent();
-    if(!nextchanges)
-	return;
-    setlastline();
-    if(curchange->next) {
-	freechanges(curchange->next);
-	curchange->next = NULL;
-	free(curchange->del);
-	free(curchange->ins);
-	curchange->del = curchange->ins = NULL;
-	curchange->dell = curchange->insl = 0;
+    if(nextchanges) {
+	setlastline();
+	if(curchange->next) {
+	    freechanges(curchange->next);
+	    curchange->next = NULL;
+	    free(curchange->del);
+	    free(curchange->ins);
+	    curchange->del = curchange->ins = NULL;
+	    curchange->dell = curchange->insl = 0;
+	}
+	nextchanges->prev = curchange->prev;
+	if(curchange->prev)
+	    curchange->prev->next = nextchanges;
+	else
+	    changes = nextchanges;
+	curchange->prev = endnextchanges;
+	endnextchanges->next = curchange;
+	nextchanges = endnextchanges = NULL;
     }
-    nextchanges->prev = curchange->prev;
-    if(curchange->prev)
-	curchange->prev->next = nextchanges;
-    else
-	changes = nextchanges;
-    curchange->prev = endnextchanges;
-    endnextchanges->next = curchange;
-    nextchanges = endnextchanges = NULL;
 
     if (remetafy)
 	metafy_line();