about summary refs log tree commit diff
path: root/Completion/X/_x_arguments
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-03-27 13:03:49 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-03-27 13:03:49 +0000
commite48f71e2165072a813aa91c11b61dae69afc8c3c (patch)
tree3a6db907a0de31d995bd944d595ab1b49dd445b7 /Completion/X/_x_arguments
parentaa9c315cc872f86465a83dba3546ee62317297ba (diff)
downloadzsh-e48f71e2165072a813aa91c11b61dae69afc8c3c.tar.gz
zsh-e48f71e2165072a813aa91c11b61dae69afc8c3c.tar.xz
zsh-e48f71e2165072a813aa91c11b61dae69afc8c3c.zip
make _arguments return 300 only if given the -R option (13790)
Diffstat (limited to 'Completion/X/_x_arguments')
-rw-r--r--Completion/X/_x_arguments39
1 files changed, 34 insertions, 5 deletions
diff --git a/Completion/X/_x_arguments b/Completion/X/_x_arguments
index 23243002c..8f1723cc6 100644
--- a/Completion/X/_x_arguments
+++ b/Completion/X/_x_arguments
@@ -1,6 +1,35 @@
-#compdef -P */X11/*
+#compdef -P */X11(|R[456])/*
 
-_arguments \
-  '-display:display:_x_display' \
-  '-geometry:geometry:_x_geometry' \
-  "$@"
+local ret long xargs opts rawret nm="$compstate[nmatches]"
+
+xargs=(
+  '-display:display:_x_display'
+  '-geometry:geometry:_x_geometry'
+)
+
+(( $# )) || xargs=( "$xargs[@]" '*:default: _default' )
+
+long=$argv[(I)--]
+if (( long )); then
+  argv[long]=( "$xargs[@]" -- )
+else
+  set -- "$@" "$xargs[@]"
+fi
+
+opts=()
+while [[ $1 = -(O*|[CR]) ]]; do
+  opts=($opts $1)
+  [[ $1 = -R ]] && rawret=yes
+  shift
+done
+
+_arguments -R "$opts[@]" "$@"
+
+ret=$?
+
+if [[ "$ret" = 300 ]]; then
+  compstate[restore]=''
+  [[ -z $rawret ]] && ret=$(( nm == $compstate[nmatches] ))
+fi
+
+return ret