Fix completion performance with shrink=True.
Before, the completion was shrinked every time any item was removed/added to the completion (rowsRemoved/rowsInserted signals), which was >3000 times when completing history. Also, the signals got connected multiple times if setting the same model, which made the situation worse. Fixes #734.
This commit is contained in:
parent
c776958388
commit
622938e3d3
@ -81,6 +81,7 @@ Fixed
|
|||||||
- Fixed handling of keybindings containing Ctrl/Meta on OS X.
|
- Fixed handling of keybindings containing Ctrl/Meta on OS X.
|
||||||
- Fixed crash when downloading an URL without filename (e.g. magnet links) via "Save as...".
|
- Fixed crash when downloading an URL without filename (e.g. magnet links) via "Save as...".
|
||||||
- Fixed exception when starting qutebrowser with `:set` as argument.
|
- Fixed exception when starting qutebrowser with `:set` as argument.
|
||||||
|
- Fixed horrible completion performance when the `shrink` option was set.
|
||||||
|
|
||||||
https://github.com/The-Compiler/qutebrowser/releases/tag/v0.2.1[v0.2.1]
|
https://github.com/The-Compiler/qutebrowser/releases/tag/v0.2.1[v0.2.1]
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
|
@ -272,7 +272,7 @@ class Completer(QObject):
|
|||||||
pattern = parts[self._cursor_part].strip()
|
pattern = parts[self._cursor_part].strip()
|
||||||
except IndexError:
|
except IndexError:
|
||||||
pattern = ''
|
pattern = ''
|
||||||
self._model().set_pattern(pattern)
|
completion.set_pattern(pattern)
|
||||||
|
|
||||||
log.completion.debug(
|
log.completion.debug(
|
||||||
"New completion for {}: {}, with pattern '{}'".format(
|
"New completion for {}: {}, with pattern '{}'".format(
|
||||||
|
@ -201,8 +201,17 @@ class CompletionView(QTreeView):
|
|||||||
for i in range(model.rowCount()):
|
for i in range(model.rowCount()):
|
||||||
self.expand(model.index(i, 0))
|
self.expand(model.index(i, 0))
|
||||||
self._resize_columns()
|
self._resize_columns()
|
||||||
model.rowsRemoved.connect(self.maybe_resize_completion)
|
self.maybe_resize_completion()
|
||||||
model.rowsInserted.connect(self.maybe_resize_completion)
|
|
||||||
|
def set_pattern(self, pattern):
|
||||||
|
"""Set the completion pattern for the current model.
|
||||||
|
|
||||||
|
Called from on_update_completion().
|
||||||
|
|
||||||
|
Args:
|
||||||
|
pattern: The filter pattern to set (what the user entered).
|
||||||
|
"""
|
||||||
|
self.model().set_pattern(pattern)
|
||||||
self.maybe_resize_completion()
|
self.maybe_resize_completion()
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
|
Loading…
Reference in New Issue
Block a user