+ try:
+ if begin == 0:
+ candidates = [c for c in self.options]
+ elif words[-1] in self.options[words[0]]:
+ candidates = []
+ else:
+ first = words[0]
+ candidates = self.options[first]
+
+ if being_completed:
+ self.current_candidates = [ w for w in candidates
+ if w.startswith(being_completed) ]
+ else:
+ self.current_candidates = candidates
+
+ except (KeyError, IndexError):
+ self.current_candidates = []