I got a lag when the autosuggestion take times to build the list of suggestion,
assuming vertically is time, and | is my cursor:
imp|ort
impo|
impo|rt
impo|
impor|t
You can easily reproduce that with :
from prompt_toolkit import prompt
from prompt_toolkit.history import InMemoryHistory
from prompt_toolkit.auto_suggest import AutoSuggestFromHistory
class MyHist(InMemoryHistory):
def __iter__(self):
import time
time.sleep(0.3)
return super().__iter__()
history = MyHist()
while True:
text = prompt('> ', history=history, auto_suggest=AutoSuggestFromHistory())
print('You said: %s' % text)
My guess is that it should be possible to optimistically keep the previous suggestion if the new type letter is the same than the first one of the (previous) suggestions or something similar, or better, if current string is subset of current suggestion, keep it.
I got a lag when the autosuggestion take times to build the list of suggestion, assuming vertically is time, and
|
is my cursor:You can easily reproduce that with :
My guess is that it should be possible to optimistically keep the previous suggestion if the new type letter is the same than the first one of the (previous) suggestions or something similar, or better, if current string is subset of current suggestion, keep it.
Thoughts?