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): ...@@ -56,6 +56,7 @@ class PromptApplication(CLIApplicationBase):
self._process_flags() self._process_flags()
self.mtime = None self.mtime = None
self.completer = None
def _load_file(self): def _load_file(self):
""" """
...@@ -73,11 +74,12 @@ class PromptApplication(CLIApplicationBase): ...@@ -73,11 +74,12 @@ class PromptApplication(CLIApplicationBase):
self.todolist = TodoList.TodoList(self.todofile.read()) self.todolist = TodoList.TodoList(self.todofile.read())
self.mtime = current_mtime self.mtime = current_mtime
# suppress upstream issue with Python 2.7
# pylint: disable=no-value-for-parameter
self.completer = TopydoCompleter(self.todolist)
def run(self): def run(self):
""" Main entry function. """ """ Main entry function. """
# suppress upstream issue with Python 2.7
# pylint: disable=no-value-for-parameter
completer = TopydoCompleter(self.todolist)
history = History() history = History()
while True: while True:
...@@ -86,7 +88,7 @@ class PromptApplication(CLIApplicationBase): ...@@ -86,7 +88,7 @@ class PromptApplication(CLIApplicationBase):
try: try:
user_input = get_input(u'topydo> ', history=history, user_input = get_input(u'topydo> ', history=history,
completer=completer).split() completer=self.completer).split()
except (EOFError, KeyboardInterrupt): except (EOFError, KeyboardInterrupt):
sys.exit(0) 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