add adjustable delay for completion updates

This commit is contained in:
Joakim Reinert 2017-09-27 13:39:33 +02:00
parent 6498273b31
commit 019d66a4c6
2 changed files with 10 additions and 1 deletions

View File

@ -196,6 +196,8 @@ class Completer(QObject):
For performance reasons we don't want to block here, instead we do this For performance reasons we don't want to block here, instead we do this
in the background. in the background.
We delay the update only if we've already input some text.
""" """
if (self._cmd.cursorPosition() == self._last_cursor_pos and if (self._cmd.cursorPosition() == self._last_cursor_pos and
self._cmd.text() == self._last_text): self._cmd.text() == self._last_text):
@ -203,7 +205,7 @@ class Completer(QObject):
"changes.") "changes.")
else: else:
log.completion.debug("Scheduling completion update.") log.completion.debug("Scheduling completion update.")
self._timer.start() self._timer.start(config.val.completion.delay if self._last_text else 0)
self._last_cursor_pos = self._cmd.cursorPosition() self._last_cursor_pos = self._cmd.cursorPosition()
self._last_text = self._cmd.text() self._last_text = self._cmd.text()

View File

@ -656,6 +656,13 @@ completion.web_history_max_items:
0: no history / -1: unlimited 0: no history / -1: unlimited
completion.delay:
default: 0
type:
name: Int
minval: 0
desc: Delay in ms before updating completions after typing a character
## downloads ## downloads
downloads.location.directory: downloads.location.directory: