about summary refs log tree commit diff
path: root/Completion/Core/_oldlist
blob: f42197695a56b3852a1ee3f645fc774b2b5e16ba (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
#autoload

# If this is a listing widget and there is already an old list,
# and either the compconfig key oldlist_list is `always', or it is not `never'
# and the list is not already shown, then use the existing list for listing
# (even if it was generated by another widget).
if [[ -n $compstate[old_list] && $compconfig[oldlist_list] != never &&
  $WIDGET = *list* &&
  ( $compconfig[oldlist_list] = always || $compstate[old_list] != shown ) ]]
then
  compstate[old_list]=keep
  return 0
fi

# If this is a completion widget, and we have a completion inserted already,
# and the compconfig key oldlist_menu is not never, then we cycle through the
# existing list (even if it was generated by another widget).
if [[ -n $compstate[old_insert] && $WIDGET = *complete(|-prefix|-word) &&
  $compconfig[oldlist_menu] != never ]]; then
  compstate[old_list]=keep
  if [[ $WIDGET = *reverse* ]]; then
    compstate[insert]=$(( compstate[old_insert] - 1 ))
  else
    compstate[insert]=$(( compstate[old_insert] + 1 ))
  fi
  return 0
fi

return 1