From 626e2aeb1657f112feb6d03c34bb9e9f44764c75 Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Thu, 23 Mar 2000 04:19:26 +0000 Subject: zsh-workers/10195 --- Completion/X/_x_color | 4 ++-- Completion/X/_x_cursor | 4 ++-- Completion/X/_x_display | 2 +- Completion/X/_x_extension | 8 +++++--- Completion/X/_x_font | 4 ++-- Completion/X/_x_keysym | 5 +++-- Completion/X/_x_modifier | 4 ++-- Completion/X/_x_window | 9 ++++----- Completion/X/_xmodmap | 9 ++++++--- Completion/X/_xutils | 19 +++++++++++-------- 10 files changed, 38 insertions(+), 30 deletions(-) (limited to 'Completion/X') diff --git a/Completion/X/_x_color b/Completion/X/_x_color index 43f8ad5cd..d58afcb74 100644 --- a/Completion/X/_x_color +++ b/Completion/X/_x_color @@ -30,6 +30,6 @@ if (( ! $+_color_cache )); then (( $#_color_cache )) || _color_cache=(white black gray red blue green) fi -_wanted colors expl 'color specification' && - compadd "$@" "$expl[@]" -M 'm:{a-z}={A-Z} m:-=\ r:|[ A-Z0-9]=* r:|=*' - \ +_wanted colors expl 'color specification' \ + compadd "$@" -M 'm:{a-z}={A-Z} m:-=\ r:|[ A-Z0-9]=* r:|=*' - \ "$_color_cache[@]" diff --git a/Completion/X/_x_cursor b/Completion/X/_x_cursor index 8b057a537..416ff49a5 100644 --- a/Completion/X/_x_cursor +++ b/Completion/X/_x_cursor @@ -14,5 +14,5 @@ if (( ! $+_cursor_cache )); then fi fi -_wanted cursors expl 'cursor name' && - compadd "$@" "$expl[@]" -M 'm:-=_ r:|_=*' - "$_cursor_cache[@]" +_wanted cursors expl 'cursor name' \ + compadd "$@" -M 'm:-=_ r:|_=*' - "$_cursor_cache[@]" diff --git a/Completion/X/_x_display b/Completion/X/_x_display index f547a64fa..0f0ebf9ae 100644 --- a/Completion/X/_x_display +++ b/Completion/X/_x_display @@ -1,3 +1,3 @@ #autoload -_tags displays && _hosts -S ':0 ' -r : +_wnated displays && _hosts -S ':0 ' -r : diff --git a/Completion/X/_x_extension b/Completion/X/_x_extension index 9321f4951..61b8ea2d8 100644 --- a/Completion/X/_x_extension +++ b/Completion/X/_x_extension @@ -2,16 +2,18 @@ local expl -_wanted extensions expl 'X extensions' || return 1 +_wanted extensions || return 1 (( $+_xe_cache )) || _xe_cache=( "${(@)${(@f)$(xdpyinfo)}[(r)number of extensions:*,-1][2,(r)default screen number:*][1,-2]//[ ]}" ) if [[ "$1" = -a ]]; then shift - compadd "$@" "$expl[@]" -M 'm:{a-z}={A-Z} r:|-=* r:|=*' - all "$_xe_cache[@]" + _loop extensions expl 'X extensions' \ + compadd "$@" -M 'm:{a-z}={A-Z} r:|-=* r:|=*' - all "$_xe_cache[@]" else [[ "$1" = - ]] && shift - compadd "$@" "$expl[@]" -M 'm:{a-z}={A-Z} r:|-=* r:|=*' - "$_xe_cache[@]" + _loop extensions expl 'X extensions' \ + compadd "$@" -M 'm:{a-z}={A-Z} r:|-=* r:|=*' - "$_xe_cache[@]" fi diff --git a/Completion/X/_x_font b/Completion/X/_x_font index 1be2d3312..43c7846c5 100644 --- a/Completion/X/_x_font +++ b/Completion/X/_x_font @@ -2,7 +2,7 @@ local expl -_wanted fonts expl font || return 1 +_wanted fonts || return 1 # This *has* to be improved some day... @@ -12,4 +12,4 @@ if (( ! $+_font_cache )); then _font_cache=( "${(@)^${(@f)$(_call fonts xlsfonts)}%%--*}--" ) fi -compadd -M 'r:|-=* r:|=*' "$expl[@]" "$@" -S '' - "$_font_cache[@]" +_loop fonts expl font compadd -M 'r:|-=* r:|=*' "$@" -S '' - "$_font_cache[@]" diff --git a/Completion/X/_x_keysym b/Completion/X/_x_keysym index 2e8f037b1..790571350 100644 --- a/Completion/X/_x_keysym +++ b/Completion/X/_x_keysym @@ -2,7 +2,7 @@ local expl -_wanted keysyms expl 'key symbol' || return 1 +_wanted keysyms || return 1 if (( ! $+_keysym_cache )); then local file @@ -18,4 +18,5 @@ if (( ! $+_keysym_cache )); then fi fi -compadd "$@" "$expl[@]" -M 'm:{a-z}={A-Z} r:|-=* r:|=*' - $_keysym_cache +_loop keysyms expl 'key symbol' \ + compadd "$@" -M 'm:{a-z}={A-Z} r:|-=* r:|=*' - $_keysym_cache diff --git a/Completion/X/_x_modifier b/Completion/X/_x_modifier index 01052da65..490d12ef3 100644 --- a/Completion/X/_x_modifier +++ b/Completion/X/_x_modifier @@ -2,6 +2,6 @@ local expl -_wanted modifiers expl modifier && - compadd "$@" "$expl[@]" -M 'm:{a-z}={A-Z}' - \ +_wanted modifiers expl modifier \ + compadd "$@" -M 'm:{a-z}={A-Z}' - \ Shift Lock Control Mod1 Mod2 Mod3 Mod4 Mod5 diff --git a/Completion/X/_x_window b/Completion/X/_x_window index a79f7fd62..2ca31e1bd 100644 --- a/Completion/X/_x_window +++ b/Completion/X/_x_window @@ -2,18 +2,17 @@ local list expl -_tags windows || return 1 +_wanted windows || return 1 list=( "${(@)${(M@)${(@f)$(_call windows xwininfo -root -tree)}:#[ ]#0x[0-9a-f]# \"*}##[ ]#}" ) if [[ "$1" = -n ]]; then shift - _description windows expl 'window name' - compadd "$@" "$expl[@]" -d list - "${(@)${(@)list#*\"}%%\"*}" + _loop windows expl 'window name' \ + compadd "$@" -d list - "${(@)${(@)list#*\"}%%\"*}" else [[ "$1" = - ]] && shift - _description windows expl 'window ID' - compadd "$@" "$expl[@]" -d list - "${(@)list%% *}" + _loop windows expl 'window ID' compadd "$@" -d list - "${(@)list%% *}" fi diff --git a/Completion/X/_xmodmap b/Completion/X/_xmodmap index da0029a16..01358b0d4 100644 --- a/Completion/X/_xmodmap +++ b/Completion/X/_xmodmap @@ -82,9 +82,12 @@ if [[ -n "$state" ]]; then [[ "$what" = *ksym* ]] && _x_keysym "$suf[@]" && ret=0 else - if _wanted commands expl command; then - compadd "$expl[@]" -S ' ' keycode keysym clear add remove && ret=0 - compadd "$expl[@]" -S ' = ' pointer && ret=0 + if _wanted commands; then + while _try commands expl command; do + compadd "$expl[@]" -S ' ' keycode keysym clear add remove && ret=0 + compadd "$expl[@]" -S ' = ' pointer && ret=0 + (( ret )) || return 0 + done fi fi fi diff --git a/Completion/X/_xutils b/Completion/X/_xutils index 1fe6ce468..fe01a5d30 100644 --- a/Completion/X/_xutils +++ b/Completion/X/_xutils @@ -55,20 +55,23 @@ xhost) if [[ "$tmp" = *:* ]]; then if compset -P '(#b)(*):'; then type="$match[1]" - _wanted displays expl 'disallow access' && - { - compadd "$expl[@]" -M 'm:{a-z}={A-Z} r:|[:.]=* r:|=*' - \ - ${${(M)tmp:#(#i)$type:*}#(#i)$type:} || - _hosts "$expl[@]" - } + _wanted displays && + while _try displays expl 'disallow access'; do + { compadd "$expl[@]" -M 'm:{a-z}={A-Z} r:|[:.]=* r:|=*' - \ + ${${(M)tmp:#(#i)$type:*}#(#i)$type:} || + _hosts "$expl[@]" } && return 0 + done else _alternative \ 'types:name family:compadd -S: ${(L)tmp%%:*}' \ 'hosts:host:compadd ${(@)tmp#*:}' && ret=0 fi else - _wanted displays expl 'disallow access' && - { compadd "$expl[@]" -M 'm:{a-z}={A-Z} r:|[:.]=* r:|=*' - $tmp || _hosts "$expl[@]" } + _wanted displays && + while _try displays expl 'disallow access'; do + { compadd "$expl[@]" -M 'm:{a-z}={A-Z} r:|[:.]=* r:|=*' - $tmp || + _hosts "$expl[@]" } && return 0 + done fi else compset -P + -- cgit 1.4.1