From f8260fce2e423e8ba71d3d0637c3ba359fd8116f Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Fri, 18 Feb 2000 10:11:05 +0000 Subject: zsh-workers/9790 --- Completion/Builtins/_zstyle | 1 + Completion/Core/.distfiles | 2 +- Completion/Core/_message | 16 +++++++++++----- Completion/X/_x_borderwidth | 6 ++++-- Completion/X/_x_geometry | 6 ++++-- Completion/X/_x_locale | 6 ++++-- Completion/X/_x_name | 6 ++++-- Completion/X/_x_resource | 6 ++++-- Completion/X/_x_selection_timeout | 6 ++++-- Completion/X/_x_title | 6 ++++-- Doc/Zsh/compsys.yo | 7 ++++++- 11 files changed, 47 insertions(+), 21 deletions(-) diff --git a/Completion/Builtins/_zstyle b/Completion/Builtins/_zstyle index 1064c9c7e..34b424114 100644 --- a/Completion/Builtins/_zstyle +++ b/Completion/Builtins/_zstyle @@ -42,6 +42,7 @@ styles=( list-rows-first c:bool local c: matcher c: + matcher-list c: max-errors c: menu c:boolauto numbers c:bool diff --git a/Completion/Core/.distfiles b/Completion/Core/.distfiles index d540450e3..2925c6368 100644 --- a/Completion/Core/.distfiles +++ b/Completion/Core/.distfiles @@ -1,7 +1,7 @@ DISTFILES_SRC=' .distfiles _alternative _approximate _compalso _complete _correct _description - _expand _files _funcall _list _main_complete _match _matcher + _expand _files _funcall _list _main_complete _match _menu _multi_parts _message _normal _oldlist _options _parameters _path_files _prefix _requested _sep_parts _set_options _setup _sort_tags _tags diff --git a/Completion/Core/_message b/Completion/Core/_message index a6cb799e5..15a458407 100644 --- a/Completion/Core/_message +++ b/Completion/Core/_message @@ -1,14 +1,20 @@ #autoload -local format +local format raw _tags messages || return 1 -zstyle -s ":completion:${curcontext}:messages" format format || - zstyle -s ":completion:${curcontext}:descriptions" format format +if [[ "$1" = -r ]]; then + raw=yes + shift + format="$1" +else + zstyle -s ":completion:${curcontext}:messages" format format || + zstyle -s ":completion:${curcontext}:descriptions" format format +fi -if [[ -n "$format" ]]; then - zformat -f format "$format" "d:$1" "${(@)argv[2,-1]}" +if [[ -n "$format$raw" ]]; then + [[ -z "$raw" ]] && zformat -f format "$format" "d:$1" "${(@)argv[2,-1]}" if [[ $compstate[nmatches] -eq 0 ]]; then compstate[list]='list force' compstate[insert]='' diff --git a/Completion/X/_x_borderwidth b/Completion/X/_x_borderwidth index 1864e8a77..c2f0eec83 100644 --- a/Completion/X/_x_borderwidth +++ b/Completion/X/_x_borderwidth @@ -1,7 +1,9 @@ #autoload -if (( $# )); then - _message "$2" +local x="$argv[(I)-X]" + +if (( x )); then + _message -r "$argv[x + 1]" else _message 'border width' fi diff --git a/Completion/X/_x_geometry b/Completion/X/_x_geometry index 5584cb75f..a15dd16d9 100644 --- a/Completion/X/_x_geometry +++ b/Completion/X/_x_geometry @@ -1,7 +1,9 @@ #autoload -if (( $# )); then - _message "$2" +local x="$argv[(I)-X]" + +if (( x )); then + _message -r "$argv[x + 1]" else _message 'geometry' fi diff --git a/Completion/X/_x_locale b/Completion/X/_x_locale index 62415f857..2321b1a5b 100644 --- a/Completion/X/_x_locale +++ b/Completion/X/_x_locale @@ -1,7 +1,9 @@ #autoload -if (( $# )); then - _message "$2" +local x="$argv[(I)-X]" + +if (( x )); then + _message -r "$argv[x + 1]" else _message 'locale' fi diff --git a/Completion/X/_x_name b/Completion/X/_x_name index 692e56736..38d4c26d3 100644 --- a/Completion/X/_x_name +++ b/Completion/X/_x_name @@ -1,7 +1,9 @@ #autoload -if (( $# )); then - _message "$2" +local x="$argv[(I)-X]" + +if (( x )); then + _message -r "$argv[x + 1]" else _message 'name' fi diff --git a/Completion/X/_x_resource b/Completion/X/_x_resource index f46eef15c..a0b8e0f21 100644 --- a/Completion/X/_x_resource +++ b/Completion/X/_x_resource @@ -1,7 +1,9 @@ #autoload -if (( $# )); then - _message "$2" +local x="$argv[(I)-X]" + +if (( x )); then + _message -r "$argv[x + 1]" else _message 'resource' fi diff --git a/Completion/X/_x_selection_timeout b/Completion/X/_x_selection_timeout index 5481cd7fe..d6dfd8a13 100644 --- a/Completion/X/_x_selection_timeout +++ b/Completion/X/_x_selection_timeout @@ -1,7 +1,9 @@ #autoload -if (( $# )); then - _message "$2" +local x="$argv[(I)-X]" + +if (( x )); then + _message -r "$argv[x + 1]" else _message 'selection timeout' fi diff --git a/Completion/X/_x_title b/Completion/X/_x_title index c892702b1..fe2ab7b9f 100644 --- a/Completion/X/_x_title +++ b/Completion/X/_x_title @@ -1,7 +1,9 @@ #autoload -if (( $# )); then - _message "$2" +local x="$argv[(I)-X]" + +if (( x )); then + _message -r "$argv[x + 1]" else _message 'title' fi diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo index 0d84044c4..119ff8f2b 100644 --- a/Doc/Zsh/compsys.yo +++ b/Doc/Zsh/compsys.yo @@ -1922,7 +1922,7 @@ _description expl files file compadd "$expl[@]" - "$files[@]") ) findex(_message) -item(tt(_message) var(descr))( +item(tt(_message) [ -r ] var(descr))( The var(descr) is used like the third argument to the tt(_description) function. However, the resulting string will always be shown whether or not matches were @@ -1932,6 +1932,11 @@ completions can be generated automatically. This function also uses the tt(format) style for the tt(messages) tag in preference to the tt(format) style for the tt(descriptions) tag. The latter is used only if the former is unset. + +If the tt(-r) option is given, no style is used and the var(descr) is +used literally as the string to display. This is only used in cases +where that string is taken from some pre-processed argument list +containing an expanded description. ) findex(_setup) item(tt(_setup) var(tag))( -- cgit 1.4.1