survey icon indicating copy to clipboard operation
survey copied to clipboard

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

Open vlours opened this issue 2 years ago • 3 comments

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-

vlours avatar May 11 '22 00:05 vlours

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

mislav avatar May 16 '22 12:05 mislav

what about:

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

This will also provide the way to break it.

vlours avatar May 17 '22 05:05 vlours

@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

mislav avatar May 17 '22 10:05 mislav