-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to delete the text input #119
Comments
same issue |
Same issue but works with ctrl-h |
I faced the same issue. Version info: class Text(BaseConsoleRender):
...
def process_input(self, pressed):
+ print("##", print(pressed))
if pressed == key.CTRL_C:
import inquirer
questions = [
inquirer.Text("name", message="What's your name?"),
]
answers = inquirer.prompt(questions)
print(answers) And, the result is as follows: $ python3 my_cli.py
[?] What's your name?: a # <= Pressed "a"
## None
[?] What's your name?: ab # <= Pressed "b"
## None
[?] What's your name?: abc # <= Pressed "c"
## None
[?] What's your name?: abc # <= Pressed Backspace
## None
[?] What's your name?: abc # <= Pressed Backspace
## None
[?] What's your name?: abc # <= Pressed Enter
## None
{'name': 'abc\x7f\x7f'} I think, |
Sorry, there was an error in the above debugging code. class Text(BaseConsoleRender):
...
def process_input(self, pressed):
- print("##", print(pressed))
+ print()
+ print('##', pressed, type(pressed))
if pressed == key.CTRL_C:
It is natural that [?] What's your name?: # <= Pressed a
## a <class 'str'>
[?] What's your name?: a # <= Pressed b
## b <class 'str'>
[?] What's your name?: ab # <= Pressed c
## c <class 'str'>
[?] What's your name?: abc # <= Pressed Backspace
## <class 'str'>
[?] What's your name?: abc # <= Pressed Backspace
## <class 'str'>
[?] What's your name?: abc # <= Pressed Enter
<class 'str'>
{'name': 'abc\x7f\x7f'} |
I've also ran into this issue. I think the bug was introduced in 2.9.0 (I'm unable to reproduce this issue using 2.8.0). |
face the same issue. so I downgrade the version |
This issue doesn't occur when installing directly from the github repo. Try
and it will work. So I'm not sure what has been deployed to Pypi... |
Installing directly from Github still produces the same issue. Tested on Ubuntu 21 with Python 3.10. |
I got the issue on v2.9.1, but not on v2.9.0 (both versions from PyPI). |
OSX 12.1 |
not working on pop os 22.04 / python 3.10 with inquirer 2.9.2 either! this is literally the most basic thing the library is supposed to be able to do, yet still cant handle text?? |
OSX 12.3.1 |
The problem seems to be (at least on OSX 11.6.5) that backspace is interpreted as A workaround which might be useful is to place this somewhere before using inquirer:
|
Thanks, @ian-grover, that solution also works on Linux. Updated patch: import sys, readchar # fix inquirer
if any(x in sys.platform for x in ['darwin', 'linux']):
# change readchar key backspace
readchar.key.BACKSPACE = '\x7F' I'll make a PR fixing this if I can. |
This is actually a problem with V3.0.5 of the underlying |
fixed with the new version of |
thanks @Cube707 upgrading to readchar 3.1.0 fixed this for me, eg:
|
@Cube707 should this issue be closed then? |
From my side, yes. Your decision if you want to wait on feedback from the participants. But as they could just reopen, I would close it. |
While using inquirer.Text or inquirer.shortcuts.text in any case the value typed is wrong unable to delete and retype the correct input
For eg:
[?] Provide the VM Size [example:Standard_B2s]: asdasdasdasd - Junk value entered , I need to delete and retype correct information, I know the "validation" can be an option but my question is when user realized he typed a wrong value and want to correct it
If there is already an option available to overcome this problem please let me know
OS : Linux
inquirer version 2.7.0
python: 3.6.13
The text was updated successfully, but these errors were encountered: