about summary refs log tree commit diff
path: root/Completion/Core/_setup
blob: 0b9e5d0a9e8df13ab0539bdfe1382a03382c96b1 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#autoload

local val nm="$compstate[nmatches]"

if zstyle -a ":completion:${curcontext}:$1" list-colors val; then
  zmodload -i zsh/complist
  if [[ "$1" = default ]]; then
    ZLS_COLORS="${(j.:.)${(@)val:gs/:/\\\:}}"
  else
    eval "ZLS_COLORS=\"(${1})\${(j.:(${1}).)\${(@)val:gs/:/\\\:}}:\${ZLS_COLORS}\""
  fi

# Here is the problem mentioned in _main_complete.

# elif [[ "$1" = default && -n "$ZLS_COLORS$ZLS_COLOURS" ]]; then
#   zmodload -i zsh/complist
#   ZLS_COLORS="$ZLS_COLORS$ZLS_COLOURS"

fi

if zstyle -t ":completion:${curcontext}:$1" list-packed; then
  compstate[list]="${compstate[list]} packed"
elif [[ $? -eq 1 ]]; then
  compstate[list]="${compstate[list]:gs/packed//}"
else
  compstate[list]="$_saved_list"
fi

if zstyle -t ":completion:${curcontext}:$1" list-rows-first; then
  compstate[list]="${compstate[list]} rows"
elif [[ $? -eq 1 ]]; then
  compstate[list]="${compstate[list]:gs/rows//}"
else
  compstate[list]="$_saved_list"
fi

if zstyle -t ":completion:${curcontext}:$1" last-prompt; then
  compstate[last_prompt]=yes
elif [[ $? -eq 1 ]]; then
  compstate[last_prompt]=''
else
  compstate[last_prompt]="$_saved_lastprompt"
fi

if zstyle -t ":completion:${curcontext}:$1" accept-exact; then
  compstate[exact]=accept
elif [[ $? -eq 1 ]]; then
  compstate[exact]=''
else
  compstate[exact]="$_saved_exact"
fi

[[ _last_nmatches -ge 0 && _last_nmatches -ne nm ]] &&
    _menu_style=( "$_last_menu_style[@]" "$_menu_style[@]" )

if zstyle -a ":completion:${curcontext}:$1" menu val; then
  _last_nmatches=$(( $nm + $compstate[alternate_nmatches] ))
  _last_menu_style=( "$val[@]" )
else
  _last_nmatches=-1
fi