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

Is there any way to cut short long row entries #357

Open
oliashish opened this issue Aug 8, 2023 · 3 comments
Open

Is there any way to cut short long row entries #357

oliashish opened this issue Aug 8, 2023 · 3 comments
Labels
question Further information is requested

Comments

@oliashish
Copy link
Contributor

oliashish commented Aug 8, 2023

Hello Everyone,
I have a situation where I'm trying to list the number of entries by users. But a few of them are quite long and are making the layout ugly and unfortunately, I'm unable to find the solution for the same in the docs(sorry if I missed it in the docs)

So I wanted to ask if is there a way to

  1. Achieve ellipsis on the long text(entries) or
  2. Some sort of column_width preferably with min and max options to help even if we resize the shell/terminal.

Please let me know if we can achieve any of the above.

If there is no direct then I'm thinking of a solution like is to create a mutable vector with a capacity of user_entries.len() and then manipulating the entry with \n (if it reaches a certain word count).

Please let me know if this is a good approach to the problem or if there is any workaround available please do let me know.
Thank you

@zhiburt zhiburt added the question Further information is requested label Aug 8, 2023
@oliashish
Copy link
Contributor Author

Hey @zhiburt Thank you for the resource
WIll definitely look into them and update you once done.

Thanks

@oliashish
Copy link
Contributor Author

Hey @zhiburt thank you for the solution.
From the above-given resources this one got perfect with my use-case - table.with(Modify::new(Segment::all()).with(Width::wrap(5)));

with(Modify::new(Segment::all()).with(Width::truncate(3).suffix("..."))); this one also worked but if the user want to read out the full entry then it would be a pain(I guess) to add some logic of read more/expand etc

Therefore going with the first solution.
Thank you for helping :-)

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

No branches or pull requests

2 participants