about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Core/_message26
1 files changed, 15 insertions, 11 deletions
diff --git a/Completion/Core/_message b/Completion/Core/_message
index 0837cdf2f..8e1d23679 100644
--- a/Completion/Core/_message
+++ b/Completion/Core/_message
@@ -1,19 +1,23 @@
 #autoload
 
-local format
+local format raw
 
-format="$compconfig[message_format]"
-[[ -z "$format" ]] && "$compconfig[description_format]"
+_tags messages || return 1
 
-if [[ -n "$format" ]]; then
+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$raw" ]]; then
+  [[ -z "$raw" ]] && zformat -f format "$format" "d:$1" "${(@)argv[2,-1]}"
+  compadd -x "$format"
   if [[ $compstate[nmatches] -eq 0 ]]; then
-    compstate[list]=list
+    compstate[list]='list force'
     compstate[insert]=''
-    compadd -UX "${format//\\%d/$1}" -n ''
-  else
-    compadd -X "${format//\\%d/$1}" -n ''
   fi
-  compstate[force_list]=yes
-else
-  compadd -n ''
 fi