summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2005-08-10 19:51:30 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2005-08-10 19:51:30 +0000
commit817e59cf19a8a7aca42acb13254bebf7b8b24ce2 (patch)
treec4f970ac3cd3a551ca65e296893c749f849cc12b /Src
parent87ea1e93078e9ba9d0d42ac9e2d17e9af71d7892 (diff)
downloadzsh-817e59cf19a8a7aca42acb13254bebf7b8b24ce2.tar.gz
zsh-817e59cf19a8a7aca42acb13254bebf7b8b24ce2.tar.xz
zsh-817e59cf19a8a7aca42acb13254bebf7b8b24ce2.zip
21596: fix run-help, which-command, accept-and-menu-complete
Diffstat (limited to 'Src')
-rw-r--r--Src/Zle/compresult.c20
-rw-r--r--Src/Zle/zle_tricky.c2
2 files changed, 16 insertions, 6 deletions
diff --git a/Src/Zle/compresult.c b/Src/Zle/compresult.c
index 09794813f..e3b7d0523 100644
--- a/Src/Zle/compresult.c
+++ b/Src/Zle/compresult.c
@@ -687,6 +687,8 @@ instmatch(Cmatch m, int *scs)
 mod_export int
 hasbrpsfx(Cmatch m, char *pre, char *suf)
 {
+    METACHECK();
+
     if (m->flags & CMF_ALL)
 	return 1;
     else {
@@ -1153,6 +1155,15 @@ do_single(Cmatch m)
 mod_export void
 do_menucmp(int lst)
 {
+    int was_meta;
+
+    /* Already metafied when called from domenuselect already */
+    if (zlemetaline == NULL) {
+	was_meta = 0;
+	metafy_line();
+    } else
+	was_meta = 1;
+
     /* Just list the matches if the list was requested. */
     if (lst == COMP_LIST_COMPLETE) {
 	showinglist = -2;
@@ -1173,13 +1184,10 @@ do_menucmp(int lst)
 	     (((*minfo.cur)->flags & (CMF_NOLIST | CMF_MULT)) &&
 	      (!(*minfo.cur)->str || !*(*minfo.cur)->str)));
     /* ... and insert it into the command line. */
-    /* Already metafied when called from domenuselect already */
-    if (zlemetaline == NULL) {
-	metafy_line();
-	do_single(*minfo.cur);
+    do_single(*minfo.cur);
+
+    if (!was_meta)
 	unmetafy_line();
-    } else
-	do_single(*minfo.cur);
 }
 
 /**/
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index ba149cfe8..ee448d3bd 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -1800,6 +1800,8 @@ inststrlen(char *str, int move, int len)
 	ZS_strncpy(zleline + zlecs, zlestr, zlelen);
 	free(zlestr);
 	zsfree((char *)instr);
+	if (move)
+	    zlecs += len;
     }
     return len;
 }