Inquirer.js icon indicating copy to clipboard operation
Inquirer.js copied to clipboard

Option to not clear the prompt when validation false

Open mhkeller opened this issue 9 years ago • 6 comments

Currently when an answer false validation, the answer the user has given is also cleared. An option to have the user input remain so that it could be edited would be helpful.

My use case is that I'm asking the user to fill out text for a sample tweet with validation that the text is less than 140 characters. If the string is over 140, I give an error message with the current character count. For the user, it would be nice if they could edit the text string and resubmit instead of having their entry get cleared and have to start again.

mhkeller avatar May 23 '16 20:05 mhkeller

I agreed with @mhkeller . Are there any options to clear the screen after user submit an answer?

rohmanhm avatar Sep 24 '17 01:09 rohmanhm

PR welcomed. I think the default behavior should be updated to not clear the initial answer.

SBoudrias avatar Sep 24 '17 07:09 SBoudrias

I get the opposite behavior - the input does not clear upon validation error. Was there a change that made this the default behavior?

rebgrasshopper avatar Nov 15 '21 20:11 rebgrasshopper

It's possible different prompts have different behaviors; or the stable version (inquirer) VS the beta ones (@inquirer/input).

Any of this would explain the different behavior?

Also anyone has strong opinion the input should be cleared? If so, we could consider adding as a configuration option

SBoudrias avatar Nov 22 '21 19:11 SBoudrias