summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--Completion/Base/Utility/_arguments22
2 files changed, 20 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 974781c7b..e2d9d351b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2016-09-06 Barton E. Schaefer <schaefer@zsh.org>
+
+ * m0viefreak: 38153 (cf. 39135): Completion/Base/Utility/_arguments:
+ change the way long options are examined for "=" signs to more
+ accurately identify options that take arguments
+
2016-09-06 Daniel Shahaf <d.s@daniel.shahaf.name>
* 39174: Completion/Unix/Command/_ssh: Fix completion of
diff --git a/Completion/Base/Utility/_arguments b/Completion/Base/Utility/_arguments
index 687c0c4ed..82c969629 100644
--- a/Completion/Base/Utility/_arguments
+++ b/Completion/Base/Utility/_arguments
@@ -105,7 +105,10 @@ if (( long )); then
continue
else
# Still no comment, add the previous options anyway.
- lopts+=("${tmp[@]}")
+ # Add a ':' after the option anyways, to make the the matching of
+ # the options lateron work as intended.
+ # It will be removed again later.
+ lopts+=("${^tmp[@]}":)
tmp=()
fi
fi
@@ -147,7 +150,7 @@ if (( long )); then
done
# Tidy up any remaining uncommented options.
if (( ${#tmp} )); then
- lopts+=("${tmp[@]}")
+ lopts+=("${^tmp[@]}":)
fi
# Remove options also described by user-defined specs.
@@ -220,19 +223,22 @@ if (( long )); then
# Ignore :descriptions at the ends of lopts for matching this;
# they aren't in the patterns.
- tmp=("${(@M)lopts:##$~pattern(|:*)}")
- lopts=("${(@)lopts:##$~pattern(|:*)}")
+ tmp=("${(@M)lopts:##$~pattern:*}")
+ lopts=("${(@)lopts:##$~pattern:*}")
(( $#tmp )) || continue
opt=''
+ # Clean suffix ':' added earlier
+ tmp=("${(@)tmp%:}")
+
# If there are option strings with a `[=', we take these to get an
# optional argument.
- tmpo=("${(@M)tmp:#*\[\=*}")
+ tmpo=("${(@M)tmp:#[^:]##\[\=*}")
if (( $#tmpo )); then
- tmp=("${(@)tmp:#*\[\=*}")
+ tmp=("${(@)tmp:#[^:]##\[\=*}")
for opt in "$tmpo[@]"; do
# Look for --option:description and turn it into
@@ -263,9 +269,9 @@ if (( long )); then
# Basically the same as the foregoing.
# TODO: could they be combined?
- tmpo=("${(@M)tmp:#*\=*}")
+ tmpo=("${(@M)tmp:#[^:]##\=*}")
if (( $#tmpo )); then
- tmp=("${(@)tmp:#*\=*}")
+ tmp=("${(@)tmp:#[^:]##\=*}")
for opt in "$tmpo[@]"; do
if [[ $opt = (#b)(*):([^:]#) ]]; then