about summary refs log tree commit diff
path: root/Completion/Core/_message
blob: 15a458407da83472482ce9655f49c0585ab5756d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#autoload

local format raw

_tags messages || return 1

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]}"
  if [[ $compstate[nmatches] -eq 0 ]]; then
    compstate[list]='list force'
    compstate[insert]=''
    compadd -UX "${format}" -n ''
  else
    compadd -X "${format}" -n '' && compstate[list]='list force'
  fi
fi