-
Notifications
You must be signed in to change notification settings - Fork 110
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
Cell alignment based on content like in Excel #303
Comments
I haven't forgotten this suggestion from the other PR of yours. Give me some time to think about this, real-life-work is keeping me busy. |
no issue. I implemented it in the |
Solved it a little differently to account for all usages of text.Align* in a new branch Try it and let me know if that works for you. |
That works for me! Thanks a lot!
I'm currently experimenting with my fork, how to properly sort mixed-columns. |
P.S.: I've implemented, as a proposal, in my sort-auto an AscAuto and DscAuto which will group Numbers before Text and sort both of them numerically resp. textually, ignoring case. |
I've fixed Sorting to take into account missing cells in a new commit on the same branch.
|
Release with fix(es): https://github.com/jedib0t/go-pretty/releases/tag/v6.5.5 |
Please also consider ignoring case when sorting. While it is logical for programmers that "a" comes after "Z", it's illogical for non-programmers which will use the programs. Maybe add |
That sounds like a good feature. Want to contribute a PR? If not, I'll get it done in the near future. |
I will try. |
See #309 |
Is your feature request related to a problem? Please describe.
As stated in #299 I do not know the data I get in my app and keeping track of the "numericality" seems like duplicate work to me.
As I proposed there, maybe an automatic cell alignement similar to Excel (or any other spreadsheet program) could be useful to some.
I would have expected that
text.AlignDefault
would do this, but it applies to the whole column and is based on the "common denominator" of all cells in the column.To not break compatibility, this behavior cannot be changed.
Describe the solution you'd like
I propose a new
text.AutoCell
alignment, which alignes cells based on its content:Of course this only works for text and html tables. Markdown, csv, and tsv won't benefit.
Describe alternatives you've considered
Alternatively everyone wanting numbers to be auto aligned right and and text in the same column left, has no choice. They have to decide for one of those.
Additional context
I already had a go at the implementation and it seems to work.
Perhaps what I have done is a little too crude for your taste, but I would like to discuss it with you.
The text was updated successfully, but these errors were encountered: