Open ghost opened 5 years ago
Hi @namedLambda,
Did you try wrapping this VTKeyValidator
into a ThreadedValidator
?
See: https://github.com/prompt-toolkit/python-prompt-toolkit/blob/master/prompt_toolkit/validation.py#L122
vt_key = prompt('Key:', validator=ThreadedValidator(VTKeyValidator()), validate_while_typing=False)
That will run the validation code in a different thread. Let me know if that doesn't help.
This works great. So if I got this correct, validate_while_typing=False simply suppresses validation errors until a new line or EOF but the process still runs. Is that correct?
I think this could be a bug, I have to check it. The validator is not supposed to run on every key press if validate_while_typing
is False.
That would explain the behavior as the validator I am using is connecting to a server and accounting for that justifies the observed delay. Would you like any more information/code for this?
In this case, VTKeyValidator is using the network to validate the input. My problem is that simply typing in terminal takes half a second to display the typed character.
2.0.9