diff options
author | Bart Schaefer <barts@users.sourceforge.net> | 2001-05-06 22:35:08 +0000 |
---|---|---|
committer | Bart Schaefer <barts@users.sourceforge.net> | 2001-05-06 22:35:08 +0000 |
commit | d58c1780fd6c528ee953a44f7739ce0021ac26b5 (patch) | |
tree | 458bf90f137dc69f1abc6ce0820a6b595b0dde4f | |
parent | c687e5f515d661919f2a73b63fa880902ff001e1 (diff) | |
download | zsh-d58c1780fd6c528ee953a44f7739ce0021ac26b5.tar.gz zsh-d58c1780fd6c528ee953a44f7739ce0021ac26b5.tar.xz zsh-d58c1780fd6c528ee953a44f7739ce0021ac26b5.zip |
Improve handling of b/n/s subscript flags.
-rw-r--r-- | Completion/Zsh/Context/_subscript | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/Completion/Zsh/Context/_subscript b/Completion/Zsh/Context/_subscript index 83cacc9af..bca521714 100644 --- a/Completion/Zsh/Context/_subscript +++ b/Completion/Zsh/Context/_subscript @@ -8,15 +8,39 @@ if [[ "$1" = -q ]]; then shift fi -compset -P '\([^\)]##\)' # remove subscript flags +compset -P '\(([^\(\)]|*\(*\)*)##\)' # remove subscript flags if [[ "$PREFIX" = :* ]]; then _wanted characters expl 'character class' \ compadd -p: -S ':]' alnum alpha blank cntrl digit graph \ lower print punct space upper xdigit elif compset -P '\('; then + local match compset -S '\)*' + if [[ $PREFIX = (#b)*([bns])(?|)(*) ]]; then + local f=$match[1] d=$match[2] e=$match[2] v=$match[3] + [[ $f = s && ${(Pt)${compstate[parameter]}} != scalar ]] && return 1 + if [[ -z $d ]]; then + _message 'delimiter' + return + else + case $d in + (\() e=\);; + (\[) e=\];; + (\{) e=\};; + esac + if [[ $v != *$e* ]]; then + case $f in + (s) _message 'separator string';; + (b|n) [[ $v = <-># ]] && _message 'number' || return 1;; + esac + [[ -n $v && $SUFFIX$ISUFFIX != *$e* ]] && _message 'delimiter' + return 0 + fi + fi + fi + case ${(Pt)${compstate[parameter]}} in assoc*) flags=( '(R k K i I)r[any one value matched by subscript as pattern]' |