summary refs log tree commit diff
path: root/Completion/Base/_subscript
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2000-10-10 14:12:21 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2000-10-10 14:12:21 +0000
commitb9f6bdf162ccdd6b6c644c63a42f993d271ccdce (patch)
tree347e5604968962abbf9732f854c229b9995a7ab5 /Completion/Base/_subscript
parentbd4490b966dd4c06bd1088d432418ff764552ce2 (diff)
downloadzsh-b9f6bdf162ccdd6b6c644c63a42f993d271ccdce.tar.gz
zsh-b9f6bdf162ccdd6b6c644c63a42f993d271ccdce.tar.xz
zsh-b9f6bdf162ccdd6b6c644c63a42f993d271ccdce.zip
add fake-parameters style to allow completing parameters which are not yet set (12946)
Diffstat (limited to 'Completion/Base/_subscript')
-rw-r--r--Completion/Base/_subscript14
1 files changed, 10 insertions, 4 deletions
diff --git a/Completion/Base/_subscript b/Completion/Base/_subscript
index e3bde552a..9a6801352 100644
--- a/Completion/Base/_subscript
+++ b/Completion/Base/_subscript
@@ -1,6 +1,12 @@
 #compdef -subscript-
 
-local expl
+local expl osuf=']'
+
+if [[ "$1" = -q ]]; then
+  osuf='] '
+  compquote osuf
+  shift
+fi
 
 if [[ "$PREFIX" = :* ]]; then
   _wanted characters expl 'character class' \
@@ -9,7 +15,7 @@ if [[ "$PREFIX" = :* ]]; then
 elif [[ ${(Pt)${compstate[parameter]}} = assoc* ]]; then
   local suf
 
-  [[ "$RBUFFER" != \]* ]] && suf=']'
+  [[ "$RBUFFER" != (|\\)\]* ]] && suf="$osuf"
 
   _wanted association-keys expl 'association key' \
       compadd -S "$suf" -k "$compstate[parameter]"
@@ -37,12 +43,12 @@ elif [[ ${(Pt)${compstate[parameter]}} = array* ]]; then
         disp=()
       fi
 
-      if [[ "$RBUFFER" = \]* ]]; then
+      if [[ "$RBUFFER" = (|\\)\]* ]]; then
         _all_labels -V indexes expl 'array index' \
             compadd -S '' "$disp[@]" -a ind && ret=0
       else
         _all_labels -V indexes expl 'array index' \
-            compadd -S ']' "$disp[@]" -a ind && ret=0
+            compadd -S "$osuf" "$disp[@]" -a ind && ret=0
       fi
     fi
     _requested parameters && _parameters && ret=0