about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-08-17 09:25:21 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-08-17 09:25:21 +0000
commit66576ecbf8378a0d93e5ae7da7822c1a21fa219d (patch)
tree350bab85339d9abe94c9d762b95f0481579adde1 /Src
parent91ef933eb3447dc3fcccbe2b9107397410364531 (diff)
downloadzsh-66576ecbf8378a0d93e5ae7da7822c1a21fa219d.tar.gz
zsh-66576ecbf8378a0d93e5ae7da7822c1a21fa219d.tar.xz
zsh-66576ecbf8378a0d93e5ae7da7822c1a21fa219d.zip
15650
Diffstat (limited to 'Src')
-rw-r--r--Src/Zle/compcore.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index d3f720478..f75c8dc20 100644
--- a/Src/Zle/compcore.c
+++ b/Src/Zle/compcore.c
@@ -1782,21 +1782,23 @@ addmatches(Cadata dat, char **argv)
 	} else
 	    lsl = 0;
 	if (dat->aflags & CAF_MATCH) {
-	    int ml, gfl = 0;
+	    int ml, gfl = 0, tildepat = 0;
 	    char *globflag = NULL;
 
 	    if (comppatmatch && *comppatmatch &&
-		dat->ppre && lpre[0] == '(' && lpre[1] == '#') {
+		lpre[0] == '(' && lpre[1] == '#') {
 		char *p;
 
 		for (p = lpre + 2; *p && *p != ')'; p++);
 
-		if (*p == ')') {
+		if (*p == ')' && (dat->ppre || p[1] == '~')) {
 		    char sav = p[1];
 
 		    p[1] = '\0';
 		    globflag = dupstring(lpre);
 		    gfl = p - lpre + 1;
+                    if (!dat->ppre)
+                        tildepat = 1;
 		    p[1] = sav;
 
 		    lpre = p + 1;
@@ -1859,7 +1861,11 @@ addmatches(Cadata dat, char **argv)
 		int is = (*comppatmatch == '*');
 		char *tmp = (char *) zhalloc(2 + llpl + llsl + gfl);
 
-		if (gfl) {
+		if (tildepat) {
+                    tmp[0] = '~';
+                    strcpy(tmp + 1, globflag);
+                    strcat(tmp, lpre + 1);
+                } else if (gfl) {
 		    strcpy(tmp, globflag);
 		    strcat(tmp, lpre);
 		} else