about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>2000-02-18 09:37:17 +0000
committerTanaka Akira <akr@users.sourceforge.net>2000-02-18 09:37:17 +0000
commita76b8ea1a52442c2a287db12305b34c3e2b16f7f (patch)
tree61364d752642aa090038bb0dcfa587d1ce662c3c
parent680a2161a4cd2b26373408a3ca5f935ab17cc43d (diff)
downloadzsh-a76b8ea1a52442c2a287db12305b34c3e2b16f7f.tar.gz
zsh-a76b8ea1a52442c2a287db12305b34c3e2b16f7f.tar.xz
zsh-a76b8ea1a52442c2a287db12305b34c3e2b16f7f.zip
zsh-workers/9787
-rw-r--r--Completion/Core/_expand15
-rw-r--r--Src/utils.c33
2 files changed, 41 insertions, 7 deletions
diff --git a/Completion/Core/_expand b/Completion/Core/_expand
index 8279a1406..eee3f9b81 100644
--- a/Completion/Core/_expand
+++ b/Completion/Core/_expand
@@ -34,9 +34,9 @@ zstyle -s ":completion:${curcontext}:" substitute expr &&
 
 # If the array is empty, store the original string again.
 
-[[ -z "$exp" ]] && exp=("$word")
+(( $#exp )) || exp=("$word")
 
-subd="$exp"
+subd=("$exp[@]")
 
 # Now try globbing.
 
@@ -47,14 +47,15 @@ zstyle -s ":completion:${curcontext}:" glob expr &&
 # If we don't have any expansions or only one and that is the same
 # as the original string, we let other completers run.
 
-[[ $#exp -eq 0 ||
-   ( $#exp -eq 1 && "$exp[1]" = "$word"(|\(N\)) ) ]] && return 1
+(( $#exp )) || exp=("$subd[@]")
+
+[[ $#exp -eq 1 && "$exp[1]" = "$word"(|\(N\)) ]] && return 1
 
 # With subst-globs-only we bail out if there were no glob expansions,
 # regardless of any substitutions
+
 zstyle -s ":completion:${curcontext}:" subst-globs-only expr &&
-    [[ "${(e):-\$[$expr]}" -eq 1 ]] &&
-    [[ "$subd" = "$exp"(|\(N\)) ]] && return 1
+    [[ "${(e):-\$[$expr]}" -eq 1 && "$subd" = "$exp"(|\(N\)) ]] && return 1
 
 # Now add as matches whatever the user requested.
 
@@ -76,7 +77,7 @@ else
   _requested all-expansions expl 'all expansions' "o:$word" &&
       compadd "$expl[@]" -UQ -qS "$suf" - "$exp"
 
-  if _requested expansions; then
+  if [[ $#exp -gt 1 ]] && _requested expansions; then
     if [[ "$sort" = menu ]]; then
       _description expansions expl expansions "o:$word"
     else
diff --git a/Src/utils.c b/Src/utils.c
index e1214302c..92963092d 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -2819,6 +2819,39 @@ bslashquote(const char *s, char **e, int instring)
 	  }
 	  continue;
 	}
+	else if (*u == Tick || *u == Qtick) {
+	    char c = *u++;
+
+	    *v++ = c;
+	    while (*u && *u != c)
+		*v++ = *u++;
+	    *v++ = c;
+	    if (!*u)
+		u--;
+	    continue;
+	}
+	else if ((*u == String || *u == Qstring) &&
+		 (u[1] == Inpar || u[1] == Inbrack || u[1] == Inbrace)) {
+	    char c = (u[1] == Inpar ? Outpar : (u[1] == Inbrace ?
+						Outbrace : Outbrack));
+	    char beg = *u;
+	    int level = 0;
+
+	    *v++ = *u++;
+	    *v++ = *u++;
+	    while (*u && (*u != c || level)) {
+		if (*u == beg)
+		    level++;
+		else if (*u == c)
+		    level--;
+		*v++ = *u++;
+	    }
+	    if (*u)
+		*v++ = *u;
+	    else
+		u--;
+	    continue;
+	}
 	else if (ispecial(*u) &&
 		 ((*u != '=' && *u != '~') ||
 		  u == s ||