summary refs log tree commit diff
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-08-20 13:13:49 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-08-20 13:13:49 +0000
commit647674f6abe8e6fd01bb115af88b43304ab00025 (patch)
treee0d41c1a185226345a17ed6068fa3fc5d2e8d3b5
parent62451960a01a5818d99f00475b933f12f66fe0fb (diff)
downloadzsh-647674f6abe8e6fd01bb115af88b43304ab00025.tar.gz
zsh-647674f6abe8e6fd01bb115af88b43304ab00025.tar.xz
zsh-647674f6abe8e6fd01bb115af88b43304ab00025.zip
undo most of 15650, do that in shell code (15669)
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Base/Completer/_approximate11
-rw-r--r--Src/Zle/compcore.c14
3 files changed, 15 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index 52e8b7104..3e76c101f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2001-08-20  Sven Wischnowsky  <wischnow@zsh.org>
+
+	* 15669: Completion/Base/Completer/_approximate,
+	Src/Zle/compcore.c: undo most of 15650, do that in shell code
+
 2001-08-18  Bart Schaefer  <schaefer@zsh.org>
 
 	* 15617: Src/exec.c: Fix exit status of zsh -fc '! command'.
diff --git a/Completion/Base/Completer/_approximate b/Completion/Base/Completer/_approximate
index 3ed8be730..39518803e 100644
--- a/Completion/Base/Completer/_approximate
+++ b/Completion/Base/Completer/_approximate
@@ -49,15 +49,16 @@ _tags corrections original
 
 if (( ! $+functions[compadd] )); then
   compadd() {
+    local ppre="$argv[(I)-p]"
+
     [[ ${argv[(I)-[a-zA-Z]#U[a-zA-Z]#]} -eq 0 &&
        "${#:-$PREFIX$SUFFIX}" -le _comp_correct ]] && return
 
-    ### This distinction doesn't seem to be needed anymore
-    # if [[ "$PREFIX" = \~*/* ]]; then
-    #   PREFIX="${PREFIX%%/*}/(#a${_comp_correct})${PREFIX#*/}"
-    # else
+    if [[ "$PREFIX" = \~* && ( ppre -eq 0 || "$argv[ppre+1]" != \~* ) ]]; then
+      PREFIX="~(#a${_comp_correct})${PREFIX[2,-1]}"
+    else
       PREFIX="(#a${_comp_correct})$PREFIX"
-    # fi
+    fi
 
     (( $_correct_group && $argv[(I)-*[JV]] )) &&
         _correct_expl[_correct_group]=${argv[(R)-*[JV]]}
diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index f75c8dc20..d3f720478 100644
--- a/Src/Zle/compcore.c
+++ b/Src/Zle/compcore.c
@@ -1782,23 +1782,21 @@ addmatches(Cadata dat, char **argv)
 	} else
 	    lsl = 0;
 	if (dat->aflags & CAF_MATCH) {
-	    int ml, gfl = 0, tildepat = 0;
+	    int ml, gfl = 0;
 	    char *globflag = NULL;
 
 	    if (comppatmatch && *comppatmatch &&
-		lpre[0] == '(' && lpre[1] == '#') {
+		dat->ppre && lpre[0] == '(' && lpre[1] == '#') {
 		char *p;
 
 		for (p = lpre + 2; *p && *p != ')'; p++);
 
-		if (*p == ')' && (dat->ppre || p[1] == '~')) {
+		if (*p == ')') {
 		    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;
@@ -1861,11 +1859,7 @@ addmatches(Cadata dat, char **argv)
 		int is = (*comppatmatch == '*');
 		char *tmp = (char *) zhalloc(2 + llpl + llsl + gfl);
 
-		if (tildepat) {
-                    tmp[0] = '~';
-                    strcpy(tmp + 1, globflag);
-                    strcat(tmp, lpre + 1);
-                } else if (gfl) {
+		if (gfl) {
 		    strcpy(tmp, globflag);
 		    strcat(tmp, lpre);
 		} else