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

Support flexible SelectFocus text width #303

Open catc opened 4 years ago

catc commented 4 years ago

Allow for icons.SelectFocus.Text to have a length > 1 and still align options correctly.

For example:

func setIcons(icons *survey.IconSet) {
    icons.SelectFocus.Text = "🌿"
}

results in misaligned select options:

Screen Shot 2020-10-04 at 5 03 28 PM

This might be a little more difficult for emojis (in my case, 🌿 is 4 bytes but has a width of 2 in the terminal) - https://github.com/rivo/uniseg might come in useful.

AlecAivazis commented 4 years ago

Thanks for reporting this @catc!