about summary refs log tree commit diff
path: root/Completion/Base/_subscript
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>2000-03-23 04:19:26 +0000
committerTanaka Akira <akr@users.sourceforge.net>2000-03-23 04:19:26 +0000
commit626e2aeb1657f112feb6d03c34bb9e9f44764c75 (patch)
tree9e4a306df7b5826a796b99f0b6ffa3423ee9f5f9 /Completion/Base/_subscript
parent766fcd5ee2ef632cd982a1ec118dbdfde17c03a8 (diff)
downloadzsh-626e2aeb1657f112feb6d03c34bb9e9f44764c75.tar.gz
zsh-626e2aeb1657f112feb6d03c34bb9e9f44764c75.tar.xz
zsh-626e2aeb1657f112feb6d03c34bb9e9f44764c75.zip
zsh-workers/10195
Diffstat (limited to 'Completion/Base/_subscript')
-rw-r--r--Completion/Base/_subscript26
1 files changed, 14 insertions, 12 deletions
diff --git a/Completion/Base/_subscript b/Completion/Base/_subscript
index c0c0b790d..aa31bd297 100644
--- a/Completion/Base/_subscript
+++ b/Completion/Base/_subscript
@@ -3,23 +3,23 @@
 local expl
 
 if [[ "$PREFIX" = :* ]]; then
-  _wanted characters expl 'character class' &&
-      compadd "$expl[@]" -p: -S ':]' alnum alpha blank cntrl digit graph \
-                                     lower print punct space upper xdigit
+  _wanted characters expl 'character class' \
+      compadd -p: -S ':]' alnum alpha blank cntrl digit graph \
+                          lower print punct space upper xdigit
 elif [[ ${(Pt)${compstate[parameter]}} = assoc* ]]; then
-  _wanted association-keys expl 'association key' &&
-      if [[ "$RBUFFER" = \]* ]]; then
-        compadd "$expl[@]" -S '' - "${(@kP)${compstate[parameter]}}"
-      else
-        compadd "$expl[@]" -S ']' - "${(@kP)${compstate[parameter]}}"
-      fi
+  local suf
+
+  [[ "$RBUFFER" != \]* ]] && suf=']'
+
+  _wanted association-keys expl 'association key' \
+      compadd -S "$suf" - "${(@kP)${compstate[parameter]}}"
 elif [[ ${(Pt)${compstate[parameter]}} = array* ]]; then
   local list i j ret=1 disp
 
   _tags indexes parameters
 
   while _tags; do
-    if _requested -V indexes expl 'array index'; then
+    if _requested indexes; then
       ind=( {1..${#${(P)${compstate[parameter]}}}} )
       if zstyle -T ":completion:${curcontext}:indexes" verbose; then
         list=()
@@ -38,9 +38,11 @@ elif [[ ${(Pt)${compstate[parameter]}} = array* ]]; then
       fi
 
       if [[ "$RBUFFER" = \]* ]]; then
-        compadd "$expl[@]" -S '' "$disp[@]" - "$ind[@]" && ret=0
+        _loop -V indexes expl 'array index' \
+            compadd -S '' "$disp[@]" - "$ind[@]" && ret=0
       else
-        compadd "$expl[@]" -S ']' "$disp[@]" - "$ind[@]" && ret=0
+        _loop -V indexes expl 'array index' \
+            compadd -S ']' "$disp[@]" - "$ind[@]" && ret=0
       fi
     fi
     _requested parameters && _parameters && ret=0