-
Notifications
You must be signed in to change notification settings - Fork 241
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
feat(table): improve sizing and behavior: wrap by default, overflow optionally #479
base: master
Are you sure you want to change the base?
Conversation
3b5295e
to
b1e1e9f
Compare
can you put some screenshots of before/after? |
b1e1e9f
to
ab0ad0d
Compare
@caarlos0 I just added some screenshot to the PR body. They are from the |
Also, thanks @bashbunni for all the previous work on this! I end up refactoring most of the code, but many of the new tests and examples were taken from her branches. |
Amazing! Many thanks for that @andreynering |
ab0ad0d
to
697f90f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lip Gloss
Examples
✅ Same as master
- RTL languages break on Apple's Terminal. Fine in iterm2 and kitty. Probably more to do with ansi package and terminal emulator capabilities.
✅ Same as master
- when you resize the terminal window smaller than the table, then change it back to an acceptable size it doesn't redraw quite right
✅ FIXED [Not on master
- runtime error when running pokemon table example]
Tests
All good! ✅
Glamour
✅ Artichoke Example (based on v0.7.0)
This is the only example with a table.
Before: (Glamour @ v0.7.0
- pre Lip Gloss table)
After: (Glamour @ master
using this branch for Lip Gloss table)
I think this change in style looks good and that the table sizing makes more sense in the "after" image.
Tests
Some tests fail with these changes. Haven't looked deeper on this, but may be worth addressing. Note that these could be due to adaptations we need to make to lipgloss table's usage in glamour's code base, not necessarily caused by the changes in this PR.
-
TestRendererIssues/60
- right padding or margin distribution is off given the column sizes + contents.
-
TestRendererIssues/46_2
- Unexpected spacing between rows
As mentioned above, there are other tests that are failing and likely need to be updated to work with these changes. That said, all tests pass on Glamour's master
branch, so that may indicate that this branch introduces some breaking changes. Again, needs a bit more digging to figure out why these tests are failing.
697f90f
to
2caeaa0
Compare
@bashbunni Thanks for your detailed review. I just opened charmbracelet/glamour#394 to make the tests pass on Glamour. |
@bashbunni I just fixed the bug causing a panic on the Pokemon example. |
Note: this feature should not be merged until charmbracelet/x#350 is merged and released as the new |
go 1.18 | ||
go 1.23.0 | ||
|
||
toolchain go1.23.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would leave this at 1.18
Hey everybody,
The whole work took me multiple days to get right, with a lot of testing and back-and-fourth.
I think it is very close to the ideal now. We may want to do small adjustments, and in this regard I ask for your opinion.
Highlights:
Table.String()
function.t.Wrap(false)
, the behavior of adding a trailing…
is now fixed. Before, it was just cutting the content most of the time.Note
There are many issues related to table rendering. I think this PR might fix all of them. I vote to close all these issues to clean the list up, and if any user still face any minor issue, they can still comment or open new issues to let us know.
computeHeight
doesn't honor all rows when hasHeaders is false #468Screenshots
Before
After