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

Hope can controls the width of each line and displays the number of characters entered #440

Closed robertzhangwenjie closed 1 year ago

robertzhangwenjie commented 1 year ago

Now, i am using this library to implement a git commit message generator. Although i can control the max length of prompt, i would like to have a feature that can display the number of characters entered and can wrap lines automatically according to width。

The example below demonstrates this feature. https://github.com/JosephNaberhaus/go-mitizen/blob/56f603fd666f72f69563a31175513f2a281f6334/meta/commit.gif

mislav commented 1 year ago

Hi, thank you for the feature request, but adding a character count to a text input is highly application-specific and I feel that it doesn't belong in this library. What you can do is make your own custom component, i.e. copy the Multiline component into your app and customize it there with the UI of your choice. Survey library will accept any object as long as it implements Prompt.