summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlessandro Ghedini <alessandro@ghedini.me>2014-06-29 17:26:14 -0400
committerAlessandro Ghedini <alessandro@ghedini.me>2014-07-05 00:28:05 +0200
commit25a07099725ae28c2ed898d299ca7439cdcd6d2b (patch)
treef969920e700ab9ec373cb9eb254c7956d42bc3a5
parent6cf2f634b31b75d4082ce2dc4637b561312a5b39 (diff)
downloadmpv-25a07099725ae28c2ed898d299ca7439cdcd6d2b.tar.bz2
mpv-25a07099725ae28c2ed898d299ca7439cdcd6d2b.tar.xz
TOOLS/zsh.pl: sort options in reverse order by length
This stops options that are prefixes of other options from blocking completion of values for the longer ones. Conflicts: TOOLS/zsh.pl
-rwxr-xr-xTOOLS/zsh.pl9
1 files changed, 9 insertions, 0 deletions
diff --git a/TOOLS/zsh.pl b/TOOLS/zsh.pl
index 59979015fe..67c0201440 100755
--- a/TOOLS/zsh.pl
+++ b/TOOLS/zsh.pl
@@ -133,5 +133,14 @@ sub parse_opts {
push @list, $entry
}
+ if ($parsing_main_options) {
+ @list = sort {
+ $a =~ /(.*?)\:/; my $ma = $1;
+ $b =~ /(.*?)\:/; my $mb = $1;
+
+ length($mb) <=> length($ma)
+ } @list;
+ }
+
return @list;
}