Completer: don't try to partition search.
Exit before trying to partition if the command prefix is not ':'. Resolves #1969: 'TypeError with refactored completion when searching for command'
This commit is contained in:
parent
49f8fa6d76
commit
1d2cf3b648
@ -226,11 +226,6 @@ class Completer(QObject):
|
|||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def _update_completion(self):
|
def _update_completion(self):
|
||||||
"""Check if completions are available and activate them."""
|
"""Check if completions are available and activate them."""
|
||||||
before_cursor, pattern, after_cursor = self._partition()
|
|
||||||
|
|
||||||
log.completion.debug("Updating completion: {} {} {}".format(
|
|
||||||
before_cursor, pattern, after_cursor))
|
|
||||||
|
|
||||||
if self._ignore_change:
|
if self._ignore_change:
|
||||||
log.completion.debug("Ignoring completion update because "
|
log.completion.debug("Ignoring completion update because "
|
||||||
"ignore_change is True.")
|
"ignore_change is True.")
|
||||||
@ -247,6 +242,11 @@ class Completer(QObject):
|
|||||||
completion.set_model(None)
|
completion.set_model(None)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
before_cursor, pattern, after_cursor = self._partition()
|
||||||
|
|
||||||
|
log.completion.debug("Updating completion: {} {} {}".format(
|
||||||
|
before_cursor, pattern, after_cursor))
|
||||||
|
|
||||||
pattern = pattern.strip("'\"")
|
pattern = pattern.strip("'\"")
|
||||||
model = self._get_new_completion(before_cursor, pattern)
|
model = self._get_new_completion(before_cursor, pattern)
|
||||||
|
|
||||||
|
@ -180,6 +180,7 @@ def _set_cmd_prompt(cmd, txt):
|
|||||||
(':set -t -p |', usertypes.Completion.section, ''),
|
(':set -t -p |', usertypes.Completion.section, ''),
|
||||||
(':open -- |', None, ''),
|
(':open -- |', None, ''),
|
||||||
(':gibberish nonesense |', None, ''),
|
(':gibberish nonesense |', None, ''),
|
||||||
|
('/:help|', None, ''),
|
||||||
])
|
])
|
||||||
def test_update_completion(txt, kind, pattern, status_command_stub,
|
def test_update_completion(txt, kind, pattern, status_command_stub,
|
||||||
completer_obj, completion_widget_stub):
|
completer_obj, completion_widget_stub):
|
||||||
|
Loading…
Reference in New Issue
Block a user