about summary refs log tree commit diff
path: root/Src/Zle/zle_tricky.c
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-04-25 15:43:41 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-04-25 15:43:41 +0000
commit206237c8ec4b7619d9e70a75004cd1ae1066b0a0 (patch)
treeff703cbc295605f90755edb68672ed2de11f4a81 /Src/Zle/zle_tricky.c
parent8ceb54fbc2f879e0e80f58c18761bd54db07e5f7 (diff)
downloadzsh-206237c8ec4b7619d9e70a75004cd1ae1066b0a0.tar.gz
zsh-206237c8ec4b7619d9e70a75004cd1ae1066b0a0.tar.xz
zsh-206237c8ec4b7619d9e70a75004cd1ae1066b0a0.zip
Diffstat (limited to 'Src/Zle/zle_tricky.c')
-rw-r--r--Src/Zle/zle_tricky.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index 1f13d55b4..92b167cfe 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -72,6 +72,10 @@ static int wb, we;
 
 static int offs;
 
+/* the last completion widget called */
+
+static Widget lastcompwidget;
+
 /* These control the type of completion that will be done.  They are      *
  * affected by the choice of ZLE command and by relevant shell options.   *
  * usemenu is set to 2 if we have to start automenu and 3 if we have to   *
@@ -756,10 +760,12 @@ docomplete(int lst)
 
     /* If we are doing a menu-completion... */
 
-    if (menucmp && lst != COMP_LIST_EXPAND) {
+    if (menucmp && lst != COMP_LIST_EXPAND && compwidget &&
+	compwidget == lastcompwidget) {
 	do_menucmp(lst);
 	return;
     }
+    lastcompwidget = compwidget;
 
     /* We may have to reset the cursor to its position after the   *
      * string inserted by the last completion. */
@@ -6970,10 +6976,20 @@ do_single(Cmatch m)
 		t = 1;
 	    else {
 		/* Build the path name. */
-		p = (char *) zhalloc(strlen(prpre) + strlen(str) +
+		if (m->ripre && !*psuf) {
+		    int ne = noerrs;
+
+		    p = (char *) zhalloc(strlen(m->ripre) + strlen(str) + 1);
+		    sprintf(p, "%s%s", m->ripre, str);
+		    noerrs = 1;
+		    parsestr(p);
+		    singsub(&p);
+		    noerrs = ne;
+		} else {
+		    p = (char *) zhalloc(strlen(prpre) + strlen(str) +
 				 strlen(psuf) + 3);
-		sprintf(p, "%s%s%s", (prpre && *prpre) ? prpre : "./", str, psuf);
-
+		    sprintf(p, "%s%s%s", (prpre && *prpre) ? prpre : "./", str, psuf);
+		}
 		/* And do the stat. */
 		t = (!(sr = ztat(p, &buf, 0)) && S_ISDIR(buf.st_mode));
 	    }