Merge remote-tracking branch 'origin/pr/3034'
This commit is contained in:
commit
3797b0cfed
@ -196,14 +196,25 @@ class Completer(QObject):
|
||||
|
||||
For performance reasons we don't want to block here, instead we do this
|
||||
in the background.
|
||||
|
||||
We delay the update only if we've already input some text and ignore
|
||||
updates if the text is shorter than completion.min_chars (unless we're
|
||||
hitting backspace in which case updates won't be ignored).
|
||||
"""
|
||||
if (self._cmd.cursorPosition() == self._last_cursor_pos and
|
||||
_cmd, _sep, rest = self._cmd.text().partition(' ')
|
||||
input_length = len(rest)
|
||||
if (0 < input_length < config.val.completion.min_chars and
|
||||
self._cmd.cursorPosition() > self._last_cursor_pos):
|
||||
log.completion.debug("Ignoring update because the length of "
|
||||
"the text is less than completion.min_chars.")
|
||||
elif (self._cmd.cursorPosition() == self._last_cursor_pos and
|
||||
self._cmd.text() == self._last_text):
|
||||
log.completion.debug("Ignoring update because there were no "
|
||||
"changes.")
|
||||
else:
|
||||
log.completion.debug("Scheduling completion update.")
|
||||
self._timer.start()
|
||||
start_delay = config.val.completion.delay if self._last_text else 0
|
||||
self._timer.start(start_delay)
|
||||
self._last_cursor_pos = self._cmd.cursorPosition()
|
||||
self._last_text = self._cmd.text()
|
||||
|
||||
|
@ -678,6 +678,20 @@ completion.web_history_max_items:
|
||||
|
||||
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
|
||||
|
||||
completion.min_chars:
|
||||
default: 1
|
||||
type:
|
||||
name: Int
|
||||
minval: 1
|
||||
desc: Minimum amount of characters needed to update completions
|
||||
|
||||
## downloads
|
||||
|
||||
downloads.location.directory:
|
||||
|
@ -378,7 +378,9 @@ class FakeTimer(QObject):
|
||||
def isSingleShot(self):
|
||||
return self._singleshot
|
||||
|
||||
def start(self):
|
||||
def start(self, interval=None):
|
||||
if interval:
|
||||
self._interval = interval
|
||||
self._started = True
|
||||
|
||||
def stop(self):
|
||||
@ -397,7 +399,7 @@ class InstaTimer(QObject):
|
||||
|
||||
timeout = pyqtSignal()
|
||||
|
||||
def start(self):
|
||||
def start(self, interval=None):
|
||||
self.timeout.emit()
|
||||
|
||||
def setSingleShot(self, yes):
|
||||
|
Loading…
Reference in New Issue
Block a user