Skip to content
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

default for input returns empty value #7

Closed
davidanthoff opened this issue Jan 15, 2022 · 3 comments
Closed

default for input returns empty value #7

davidanthoff opened this issue Jan 15, 2022 · 3 comments

Comments

@davidanthoff
Copy link

It seems to me that if I specify a default for an input prompt, and then the user just presses Enter, we get an empty string returned, rather than the default value. The docs say the default should be returned, and that is also what would help us :)

@Lutetium-Vanadium
Copy link
Owner

The initial behaviour was meant to be that, but it seems some feature addition broke it.

However, since the default can be auto-completed, entering an empty string to return the default value seems slightly weird to me. Also, like before the default being returned cannot be a regular behaviour for all empty strings, since that disallows entering empty strings. Instead it would only return the default if the user hadn't made any changes to the string.

From a usability standpoint, I am leaning towards updating the docs to reflect the current behaviour. Is there any reason why the default value being returned for an empty string would be preferred?

@davidanthoff
Copy link
Author

I think what I really would like is some way to start the prompt with an initial value where things start out as if the user had just typed exactly that value in by hand. I imagine that the prompt would start out with that value entered, the cursor is at the end of those characters and the user could then either delete that value with backspace etc, or add more characters etc. Essentially a way to start out with an initial value without having to use auto-complete.

Maybe that is actually just a distinct concept from a default value, where the idea seems to be that if the user does not enter anything but presses Enter without any input, that value is going to be used? So maybe there should be another method initial_value that is distinct from default?

Also, it seems to me that if default is specified, in general it just isn't possible to return an empty string, right? Isn't a default value simply a rule that if the user doesn't enter anything, then the default value is used?

@Lutetium-Vanadium
Copy link
Owner

Hmm, I get what you mean. It does make sense to have default return on an empty string, so the earlier behaviour is correct. I'll fix the implementation to reflect what the docs say.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants