diff options
author | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2001-05-15 13:52:22 +0000 |
---|---|---|
committer | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2001-05-15 13:52:22 +0000 |
commit | dc9d78c65971e9c6c7faf4488f4da6efb73bded1 (patch) | |
tree | fbafb50b748a4c7c6dae78b77bc3284324313aaa /Completion/Base/Completer | |
parent | 231f077a757b799a3e6224fcd89113ff2e67a166 (diff) | |
download | zsh-dc9d78c65971e9c6c7faf4488f4da6efb73bded1.tar.gz zsh-dc9d78c65971e9c6c7faf4488f4da6efb73bded1.tar.xz zsh-dc9d78c65971e9c6c7faf4488f4da6efb73bded1.zip |
(14350)
Diffstat (limited to 'Completion/Base/Completer')
-rw-r--r-- | Completion/Base/Completer/_expand | 27 |
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 |