manifoldco / promptui

Interactive prompt for command-line applications
https://www.manifold.co
BSD 3-Clause "New" or "Revised" License
6.03k stars 333 forks source link

Put cursor at the end of the line when providing default value #146

Closed bsinou closed 4 years ago

bsinou commented 4 years ago

With latest version (0.7.0) when running the prompt_default example from the _examples package, the cursor is placed over the first letter of the provided default value.

user@focal:~/dev/sandbox/prompt_default$ go run main.go   
✔ Username: █ser

Is it possible to rather place the cursor after last character (at the end of the line) by default? I had a look at the various available options and I have not found a way to do it.

By the way, many thanks for this tool!

5n7-sk commented 4 years ago

@bsinou

Add AllowEdit: true to your promptui.Prompt.

bsinou commented 4 years ago

@skmatz

Well... It works like a charm. Thanks for the tip.