summaryrefslogtreecommitdiff
path: root/Completion
diff options
context:
space:
mode:
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Base/_math2
-rw-r--r--Completion/Base/_subscript14
2 files changed, 11 insertions, 5 deletions
diff --git a/Completion/Base/_math b/Completion/Base/_math
index 61c991e3c..278189ebe 100644
--- a/Completion/Base/_math
+++ b/Completion/Base/_math
@@ -9,4 +9,4 @@ if [[ "$SUFFIX" = *[^a-zA-Z0-9_]* ]]; then
SUFFIX="${SUFFIX%%[^a-zA-Z0-9_]*}"
fi
-_parameters -g '(integer|float)*'
+_parameters -g '(integer|float)*' || _parameters
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