Merge branch 'fix-completer-search-crash' of https://github.com/rcorre/qutebrowser into rcorre-fix-completer-search-crash

This commit is contained in:
Florian Bruhin 2016-09-21 13:41:13 +02:00
commit 827a2d73b6
2 changed files with 6 additions and 5 deletions

View File

@ -226,11 +226,6 @@ class Completer(QObject):
@pyqtSlot()
def _update_completion(self):
"""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:
log.completion.debug("Ignoring completion update because "
"ignore_change is True.")
@ -247,6 +242,11 @@ class Completer(QObject):
completion.set_model(None)
return
before_cursor, pattern, after_cursor = self._partition()
log.completion.debug("Updating completion: {} {} {}".format(
before_cursor, pattern, after_cursor))
pattern = pattern.strip("'\"")
model = self._get_new_completion(before_cursor, pattern)

View File

@ -180,6 +180,7 @@ def _set_cmd_prompt(cmd, txt):
(':set -t -p |', usertypes.Completion.section, ''),
(':open -- |', None, ''),
(':gibberish nonesense |', None, ''),
('/:help|', None, ''),
])
def test_update_completion(txt, kind, pattern, status_command_stub,
completer_obj, completion_widget_stub):