AlecAivazis / survey

A golang library for building interactive and accessible prompts with full support for windows and posix terminals.
MIT License
4.07k stars 350 forks source link

[survey/multiline.go] Make the sentence "Enter 2 empty lines to finish" less confusing. #419

Open vlours opened 2 years ago

vlours commented 2 years ago

Hi guys,

Recently I've used a command which is including this Go file.

As a no-English first language speaker, I was a little bit confused, as I’ve first understood the sentence "[Enter 2 empty lines to finish]" as:

Enter 2 empty lines to “cancel”

So I was thinking if it will be better to use a strong word to Confirm

Press Enter two additional times to confirm your choice

# grep -n -A2 -B2 "Enter 2 empty lines to finish" cloud-credential-operator/vendor/github.com/AlecAivazis/survey/v2/multiline.go
33-{{- else }}
34-  {{- if .Default}}{{color "white"}}({{.Default}}) {{color "reset"}}{{end}}
35:  {{- color "cyan"}}[Enter 2 empty lines to finish]{{color "reset"}}
36-{{- end}}`
37-

I think this will have less confusion here:

33-{{- else }}
34-  {{- if .Default}}{{color "white"}}({{.Default}}) {{color "reset"}}{{end}}
35:  {{- color "cyan"}}[Press Enter two additional times to confirm your choice]{{color "reset"}}
36-{{- end}}`
37-
mislav commented 2 years ago

Agreed that the text could use an improvement, and thank you for proposing!

What do you think about something like the following:

Press Enter twice to end input

vlours commented 2 years ago

what about:

Press Enter twice to end input (or Ctr+C to break)

This will also provide the way to break it.

mislav commented 2 years ago

@vlours Ctrl-C is implicitly always available to abort the program, including during any Survey prompt. I don't think we have to additionally point it out.

However, Ctrl-D can be used as a signal that the user has finished typing input. I think that in this codebase, that's called KeyEndTransmission https://github.com/AlecAivazis/survey/blob/93657ef69381dd1ffc7a4a9cfe5a2aefff4ca4ad/terminal/runereader.go#L104