AlecAivazis / survey

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

Use rune when delete or filter answer #327

Closed AielloChan closed 3 years ago

AielloChan commented 3 years ago

When using Unicode in the string type answer will cause a problem.

Example:

> go run examples/simple.go
? What is your name? 小明
AlecAivazis commented 3 years ago

Hey @AielloChan! Thanks for submitting this fix, would you mind adding a test that shows the problem is fixed?

AielloChan commented 3 years ago

Check if that is ok😬

AlecAivazis commented 3 years ago

Okay, I finally found some time to pull this down and give it a shot. Thanks for being patient!

Everything seems to behave correctly on my machine, however since this touches a bunch of prompts, i'd like to get a second pair of eyes on it. Maybe @coryb or @mislav have some spare time?

AlecAivazis commented 3 years ago

Hm, I might be missing something but wouldn't this also affect the Select prompt?

AielloChan commented 3 years ago

Hm, I might be missing something but wouldn't this also affect the Select prompt?

Yes, because prompt filter also need use Rune for unicode words.

AlecAivazis commented 3 years ago

great! thanks for taking a look @mislav