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

[improvement] text wrapping improvements #38

Open
cylewitruk opened this issue Apr 12, 2024 · 4 comments
Open

[improvement] text wrapping improvements #38

cylewitruk opened this issue Apr 12, 2024 · 4 comments

Comments

@cylewitruk
Copy link
Contributor

cylewitruk commented Apr 12, 2024

We should look into a way to better wrap text automatically based on current terminal width, ideally for all components. Here's an example of a note which has a long mnemonic and turns into chaos :)

Not a blocker, I'll wrap this manually for now, but I think it's worth discussing as it's one less thing for users to think about if we can find a sensible default solution :)

image

P.S. I'm currently using textwrap for this manually.

@fadeevab
Copy link
Owner

@cylewitruk At this point, I guess you just hate having 0 issues in this repo 😄 JK. I will think about what could be done with this.

@cylewitruk
Copy link
Contributor Author

cylewitruk commented Apr 12, 2024

@cylewitruk At this point, I guess you just hate having 0 issues in this repo 😄 JK. I will think about what could be done with this.

@fadeevab haha, or rather, I was waiting for the issue count to go down before adding more 🤣

Don't feel like you need to address everything yourself, I'm happy to do some legwork as well :) But worth discussing anyway

@fadeevab
Copy link
Owner

@cylewitruk Basically, it seems like that textwrap should be inserted properly in one place.

For notes, it's format_note_generic with a terminal width argument (because the Term::stderr can be accessed in the lib.rs but must not be in the theme.rs). Moreover, textwrap is already a dependency for cliclack...

@cylewitruk
Copy link
Contributor Author

@fadeevab I wonder if this could be made even more central, with a "padding" argument to account for things like a note which has prefix/suffix (effectively reducing width for wrapping by the provided padding)? The log methods already have this functionality, and if we could consolidate that in a way that all components can use it, that could be beneficial?

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

No branches or pull requests

2 participants