about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-05-15 13:52:22 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-05-15 13:52:22 +0000
commitdc9d78c65971e9c6c7faf4488f4da6efb73bded1 (patch)
treefbafb50b748a4c7c6dae78b77bc3284324313aaa /Completion
parent231f077a757b799a3e6224fcd89113ff2e67a166 (diff)
downloadzsh-dc9d78c65971e9c6c7faf4488f4da6efb73bded1.tar.gz
zsh-dc9d78c65971e9c6c7faf4488f4da6efb73bded1.tar.xz
zsh-dc9d78c65971e9c6c7faf4488f4da6efb73bded1.zip
(14350)
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Base/Completer/_expand27
1 files changed, 25 insertions, 2 deletions
diff --git a/Completion/Base/Completer/_expand b/Completion/Base/Completer/_expand
index ebb8a905b..0e7b5820c 100644
--- a/Completion/Base/Completer/_expand
+++ b/Completion/Base/Completer/_expand
@@ -55,8 +55,31 @@ exp=("$word")
 
 if [[ "$force" = *s* ]] ||
    zstyle -T ":completion:${curcontext}:" substitute; then
-  [[ ! -o ignorebraces && "${#${exp}//[^\{]}" = "${#${exp}//[^\}]}" ]] &&
-      eval exp\=\( ${${(q)exp}:gs/\\{/\{/:gs/\\}/\}/} \) 2>/dev/null
+
+###  We once used this:
+###
+###  [[ ! -o ignorebraces && "${#${exp}//[^\{]}" = "${#${exp}//[^\}]}" ]] &&
+###      eval exp\=\( ${${(q)exp}:gs/\\{/\{/:gs/\\}/\}/} \) 2>/dev/null
+###
+###  instead of the following loop to expand braces.  But that made
+###  parameter expressions such as ${foo} be expanded like brace
+###  expansions, too (and with braceccl set...).
+
+   if [[ ! -o ignorebraces && "${#${exp}//[^\{]}" = "${#${exp}//[^\}]}" ]]; then
+     local otmp
+
+     tmp=${(q)word}
+     while [[ $#tmp != $#otmp ]]; do
+       otmp=$tmp
+       tmp=${tmp//(#b)\\\$\\\{(([^\{\}]|\\\\{|\\\\})#)([^\\])\\\}/\\$\\\\{${match[1]}${match[3]}\\\\}}
+     done
+     eval exp\=\( ${tmp:gs/\\{/\{/:gs/\\}/\}/} \) 2>/dev/null
+   fi
+
+###  There's a bug: spaces resulting from brace expansion are quoted in
+###  the following expression, too.  We don't want that, but I have no
+###  idea how to fix it.
+
   eval 'exp=( ${${(e)exp//\\[ 	
 ]/ }//(#b)([ 	
 ])/\\$match[1]} )' 2>/dev/null