First of all: thanks for maintaining this package ! I was veeery happy when I managed to make it work, and it saved us a lot of time by making multiple python scripts intuitively interactive ! :heart:
Context
I have implemented a form using questionary with 2 questions
a multi-line text prompt (that you have to validate with Alt-Enter )
a checkbox presenting a set of tags
When my users want to go too fast, they press Alt-Enter twice and this trigger a strange behavior
the first time validates the multi-line text prompt
so the checkbox form is shown
the second time is caught by the checkbox form
and it reacts by returning the empty string ''
We noticed this because the empty string is not even a list, so code breaks further down
Investigation
bug appears on versions 1.10.0 and 2.0.1
I had a look at the source code, trying to find how the keybinding logic works
I don't see any reference to either <Enter> or <Alt-Enter> in questionary code - but I might be looking for the wrong patterns
With a grep "Alt+Enter" -R in the prompt toolkit source code , I see that there are some emacs keybing config. However, the bug persists with use_emacs_keys=False
Example
import questionary
q = questionary.checkbox("Press Alt-Enter here", choices=[
questionary.Choice(a, value=a)
for a in "abc"
]).ask()
print(repr(q))
Steps to reproduce
Write down the script above in a file, and run it
When shown the checkbox form, select whatever choices you like
Instead of pressing <Enter> to validate it
press <Alt-Enter>
OR press <Esc> then <Enter>
On my machine, this will exit the checkbox form and print(repr(q)) will print ''
Expected behaviour
<Alt-Enter>/ <Esc + Enter> should not trigger any reaction
or it should behave like <Enter> and return the currently selected list
or raise an exception ?
Latest version
[X] I have checked that this issue occurs on the latest version of questionary.
Describe the bug
First of all: thanks for maintaining this package ! I was veeery happy when I managed to make it work, and it saved us a lot of time by making multiple python scripts intuitively interactive ! :heart:
Context
I have implemented a form using
questionary
with 2 questionsAlt-Enter
)When my users want to go too fast, they press
Alt-Enter
twice and this trigger a strange behavior''
We noticed this because the empty string is not even a list, so code breaks further down
Investigation
<Enter>
or<Alt-Enter>
inquestionary
code - but I might be looking for the wrong patternsgrep "Alt+Enter" -R
in the prompt toolkit source code , I see that there are someemacs
keybing config. However, the bug persists withuse_emacs_keys=False
Example
Steps to reproduce
<Enter>
to validate it<Alt-Enter>
<Esc>
then<Enter>
print(repr(q))
will print''
Expected behaviour
<Alt-Enter>
/<Esc + Enter>
should not trigger any reaction<Enter>
and return the currently selected listLatest version
Questionary version
2.0.1
Prompt Toolkit version
3.0.36
Operating System
Linux