Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use console::measure_text_width to generate size_vec in select #104

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

CircuitCoder
Copy link

This allows using ANSI escape codes in select items.

Previously line width are measured using str::len, which causes text with ANSI escape codes to be measured longer than they really are. Subsequently when clearing printed lines, additional lines can be cleared.

@pksunkara
Copy link
Collaborator

I would prefer if we integrate https://github.com/mgeisler/textwrap. That library is very high quality (I can attest to) and is being used in clap, and we personally don't need to maintain this text_width related logic.

@CircuitCoder
Copy link
Author

OK I'll look into that when I have some time.

Right now, the measured width is only used for clearing printed lines in select/sort/mult_select. If we switch to textwrap, are we going to change the way we render the options too?

@pksunkara
Copy link
Collaborator

Yeah, we need to handle multi-lines text anyway normally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants