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/comp.h5
-rw-r--r--Src/Zle/comp1.c16
-rw-r--r--Src/Zle/compctl.c23
-rw-r--r--Src/Zle/deltochar.c15
-rw-r--r--Src/Zle/zle_main.c35
-rw-r--r--Src/Zle/zle_tricky.c18
6 files changed, 93 insertions, 19 deletions
diff --git a/Src/Zle/comp.h b/Src/Zle/comp.h
index 84f8c3c98..afd55b7f1 100644
--- a/Src/Zle/comp.h
+++ b/Src/Zle/comp.h
@@ -98,7 +98,7 @@ struct compcond {
 struct compctl {
     int refc;			/* reference count                         */
     Compctl next;		/* next compctl for -x                     */
-    unsigned long mask, mask2;		/* mask of things to complete (CC_*)       */
+    unsigned long mask, mask2;	/* masks of things to complete (CC_*)      */
     char *keyvar;		/* for -k (variable)                       */
     char *glob;			/* for -g (globbing)                       */
     char *str;			/* for -s (expansion)                      */
@@ -110,7 +110,7 @@ struct compctl {
     char *withd;		/* for -w (with directory                  */
     char *hpat;			/* for -H (history pattern)                */
     int hnum;			/* for -H (number of events to search)     */
-    char *gname;
+    char *gname;		/* for -J and -V (group name)              */
     Compctl ext;		/* for -x (first of the compctls after -x) */
     Compcond cond;		/* for -x (condition for this compctl)     */
     Compctl xor;		/* for + (next of the xor'ed compctls)     */
@@ -169,7 +169,6 @@ struct cexpl {
     char *str;			/* the string */
     int count;			/* the number of matches */
     int fcount;			/* number of matches with fignore ignored */
-
 };
 
 /* This describes a group of matches. */
diff --git a/Src/Zle/comp1.c b/Src/Zle/comp1.c
index 5ffce0da2..a0c013901 100644
--- a/Src/Zle/comp1.c
+++ b/Src/Zle/comp1.c
@@ -430,7 +430,7 @@ quotename(const char *s, char **e, char *te, int *pl)
 
 /**/
 int
-boot_comp1(Module m)
+setup_comp1(Module m)
 {
     compctlreadptr = compctlread;
     clwords = (char **) zcalloc((clwsize = 16) * sizeof(char *));
@@ -446,12 +446,26 @@ boot_comp1(Module m)
     return 0;
 }
 
+/**/
+int
+boot_comp1(Module m)
+{
+    return 0;
+}
+
 #ifdef MODULE
 
 /**/
 int
 cleanup_comp1(Module m)
 {
+    return 0;
+}
+
+/**/
+int
+finish_comp1(Module m)
+{
     deletehashtable(compctltab);
     zfree(clwords, clwsize * sizeof(char *));
     compctlreadptr = fallback_compctlread;
diff --git a/Src/Zle/compctl.c b/Src/Zle/compctl.c
index 7104bfc6e..4d192fef8 100644
--- a/Src/Zle/compctl.c
+++ b/Src/Zle/compctl.c
@@ -1638,26 +1638,41 @@ static struct builtin bintab[] = {
 
 /**/
 int
-boot_compctl(Module m)
+setup_compctl(Module m)
 {
-    if(!addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab)))
-	return 1;
     compctltab->printnode = printcompctlp;
     printcompctlptr = printcompctl;
     compctl_widgetptr = compctl_widget;
     return 0;
 }
 
+/**/
+int
+boot_compctl(Module m)
+{
+    if(!addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab)))
+	return 1;
+    return 0;
+}
+
 #ifdef MODULE
 
 /**/
 int
 cleanup_compctl(Module m)
 {
-    compctltab->printnode = NULL;
     deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
+    return 0;
+}
+
+/**/
+int
+finish_compctl(Module m)
+{
+    compctltab->printnode = NULL;
     printcompctlptr = NULL;
     compctl_widgetptr = NULL;
     return 0;
 }
+
 #endif
diff --git a/Src/Zle/deltochar.c b/Src/Zle/deltochar.c
index 8869eb147..66a301119 100644
--- a/Src/Zle/deltochar.c
+++ b/Src/Zle/deltochar.c
@@ -73,6 +73,13 @@ deltochar(void)
 
 /**/
 int
+setup_deltochar(Module m)
+{
+    return 0;
+}
+
+/**/
+int
 boot_deltochar(Module m)
 {
     w_deletetochar = addzlefunction("delete-to-char", deltochar,
@@ -93,4 +100,12 @@ cleanup_deltochar(Module m)
     deletezlefunction(w_deletetochar);
     return 0;
 }
+
+/**/
+int
+finish_deltochar(Module m)
+{
+    return 0;
+}
+
 #endif
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index 57b75cd39..515405a0d 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -603,11 +603,15 @@ execzlefunc(Thingy func)
 	    zsfree(msg);
 	    feep();
 	} else {
-	  startparamscope();
-	  makezleparams();
-	  doshfunc(w->u.fnnam, l, NULL, 0, 1);
-	  endparamscope();
-	  lastcmd = 0;
+	    int osc = sfcontext;
+
+	    startparamscope();
+	    makezleparams();
+	    sfcontext = SFC_WIDGET;
+	    doshfunc(w->u.fnnam, l, NULL, 0, 1);
+	    sfcontext = osc;
+	    endparamscope();
+	    lastcmd = 0;
 	}
     }
 }
@@ -856,7 +860,7 @@ static struct builtin bintab[] = {
 
 /**/
 int
-boot_zle(Module m)
+setup_zle(Module m)
 {
     /* Set up editor entry points */
     trashzleptr = trashzle;
@@ -875,6 +879,13 @@ boot_zle(Module m)
     /* initialise the keymap system */
     init_keymaps();
 
+    return 0;
+}
+
+/**/
+int
+boot_zle(Module m)
+{
     addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
     return 0;
 }
@@ -885,15 +896,21 @@ boot_zle(Module m)
 int
 cleanup_zle(Module m)
 {
-    int i;
-
     if(zleactive) {
 	zerrnam(m->nam, "can't unload the zle module while zle is active",
 	    NULL, 0);
 	return 1;
     }
-
     deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
+    return 0;
+}
+
+/**/
+int
+finish_zle(Module m)
+{
+    int i;
+
     cleanup_keymaps();
     deletehashtable(thingytab);
 
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index cbc744601..8c976449e 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -3801,15 +3801,23 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd)
 
 	/* Completion after `~', maketildelist adds the usernames *
 	 * and named directories.                                 */
-	if (ic == Tilde)
+	if (ic == Tilde) {
+	    char *oi = ipre;
+
+	    ipre = (ipre ? dyncat("~", ipre) : "~");
 	    maketildelist();
-	else if (ic == Equals) {
+	    ipre = oi;
+	} else if (ic == Equals) {
 	    /* Completion after `=', get the command names from *
 	     * the cmdnamtab and aliases from aliastab.         */
+	    char *oi = ipre;
+
+	    ipre = (ipre ? dyncat("=", ipre) : "=");
 	    if (isset(HASHLISTALL))
 		cmdnamtab->filltable(cmdnamtab);
 	    dumphashtable(cmdnamtab, -7);
 	    dumphashtable(aliastab, -2);
+	    ipre = oi;
 	} else {
 	    /* Normal file completion... */
 	    if (ispattern & 1) {
@@ -4082,6 +4090,7 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd)
 	if ((list = getshfunc(cc->func)) != &dummy_list) {
 	    /* We have it, so build a argument list. */
 	    LinkList args = newlinklist();
+	    int osc = sfcontext;
 
 	    addlinknode(args, cc->func);
 
@@ -4099,8 +4108,10 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd)
 
 	    /* This flag allows us to use read -l and -c. */
 	    incompctlfunc = 1;
+	    sfcontext = SFC_COMPLETE;
 	    /* Call the function. */
 	    doshfunc(cc->func, list, args, 0, 1);
+	    sfcontext = osc;
 	    incompctlfunc = 0;
 	    /* And get the result from the reply parameter. */
 	    if ((r = get_user_var("reply")))
@@ -4246,6 +4257,7 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd)
 	    LinkList args = newlinklist();
 	    LinkNode ln;
 	    Cmatch m;
+	    int osc = sfcontext;
 
 	    addlinknode(args, cc->ylist);
 	    for (ln = firstnode(matches); ln; ln = nextnode(ln)) {
@@ -4263,7 +4275,9 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd)
 
 	    /* No harm in allowing read -l and -c here, too */
 	    incompctlfunc = 1;
+	    sfcontext = SFC_COMPLETE;
 	    doshfunc(cc->ylist, list, args, 0, 1);
+	    sfcontext = osc;
 	    incompctlfunc = 0;
 	    uv = "reply";
 	}