Remove needless try/catch in on_selection_changed.

This commit is contained in:
Ryan Roden-Corrent 2016-09-11 18:19:25 -04:00
parent 52fdad8186
commit 69a3df174d

View File

@ -101,14 +101,9 @@ class Completer(QObject):
Return:
A completion model.
"""
if '--' in before_cursor:
if '--' in before_cursor or under_cursor.startswith('-'):
# cursor on a flag or after an explicit split (--)
return None
try:
if under_cursor.startswith('-'):
# cursor on a flag
return None
except IndexError:
pass
log.completion.debug("Before removing flags: {}".format(before_cursor))
before_cursor = [x for x in before_cursor if not x.startswith('-')]
log.completion.debug("After removing flags: {}".format(before_cursor))