about summary refs log tree commit diff
path: root/Completion/Core/_oldlist
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Core/_oldlist')
-rw-r--r--Completion/Core/_oldlist24
1 files changed, 18 insertions, 6 deletions
diff --git a/Completion/Core/_oldlist b/Completion/Core/_oldlist
index f42197695..bdf12f90c 100644
--- a/Completion/Core/_oldlist
+++ b/Completion/Core/_oldlist
@@ -4,12 +4,24 @@
 # 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
+# Do this also if there is an old list and it was generated by the
+# completer named by the oldlist_list key.
+if [[ -n $compstate[old_list] && $compconfig[oldlist_list] != never ]]; then
+  if [[ $WIDGET = *list* &&
+        ( $compconfig[oldlist_list] = always ||
+	  $compstate[old_list] != shown ) ]]; then
+    compstate[old_list]=keep
+    return 0
+  elif [[ $compconfig[oldlist_list] = *${_lastcomp[completer]}* ]]; then
+    [[ "$_lastcomp[insert]" = unambig* ]] && compstate[to_end]=single
+    compstate[old_list]=keep
+    if [[ -o automenu ]]; then
+      compstate[insert]=menu
+    else
+      compadd -Qs "$SUFFIX" - "$PREFIX"
+    fi
+    return 0
+  fi
 fi
 
 # If this is a completion widget, and we have a completion inserted already,