Commit 82144a4b authored by Bram Schoenmakers's avatar Bram Schoenmakers

Fix autocompletion in prompt mode.

The completer would be instantiated before the todo list was loaded from
the file. Now, the completer is instantiated every time the todo list is
loaded.
parent 809d9b8b
......@@ -56,6 +56,7 @@ class PromptApplication(CLIApplicationBase):
self._process_flags()
self.mtime = None
self.completer = None
def _load_file(self):
"""
......@@ -73,11 +74,12 @@ class PromptApplication(CLIApplicationBase):
self.todolist = TodoList.TodoList(self.todofile.read())
self.mtime = current_mtime
def run(self):
""" Main entry function. """
# suppress upstream issue with Python 2.7
# pylint: disable=no-value-for-parameter
completer = TopydoCompleter(self.todolist)
self.completer = TopydoCompleter(self.todolist)
def run(self):
""" Main entry function. """
history = History()
while True:
......@@ -86,7 +88,7 @@ class PromptApplication(CLIApplicationBase):
try:
user_input = get_input(u'topydo> ', history=history,
completer=completer).split()
completer=self.completer).split()
except (EOFError, KeyboardInterrupt):
sys.exit(0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment