-
-
Notifications
You must be signed in to change notification settings - Fork 377
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: add Block::title_top and Block::title_top_bottom #940
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #940 +/- ##
=======================================
- Coverage 92.0% 91.9% -0.1%
=======================================
Files 61 61
Lines 15636 15703 +67
=======================================
+ Hits 14390 14436 +46
- Misses 1246 1267 +21 ☔ View full report in Codecov by Sentry. |
When should we mark |
It's a bit complicated. We would have to make everything that calls it work right, but probably before the next major release. |
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.
"┌A─────B──────C", "│ │", "└D─────E──────F",
Isn't it weird that C and F and all the way to the right (over the corners) but A and D keeps the corners? I naturally would expect this code to render all four corners the same way.
This was a bug and I forgot to update the commit message |
This adds the ability to add titles to the top and bottom of a block without having to use the `Title` struct (which will be removed in a future release - likely v0.28.0). Fixes a subtle bug if the title was created from a right aligned Line and was also right aligned. The title would be rendered one cell too far to the right. ```rust Block::bordered() .title_top(Line::raw("A").left_aligned()) .title_top(Line::raw("B").centered()) .title_top(Line::raw("C").right_aligned()) .title_bottom(Line::raw("D").left_aligned()) .title_bottom(Line::raw("E").centered()) .title_bottom(Line::raw("F").right_aligned()) .render(buffer.area, &mut buffer); // renders "┌A─────B─────C┐", "│ │", "└D─────E─────F┘", ``` Addresses part of #738
debb696
to
a0bd2b2
Compare
This adds the ability to add titles to the top and bottom of a block
without having to use the
Title
struct (which will be removed in afuture release - likely v0.28.0).
Fixes a subtle bug if the title was created from a right aligned Line
and was also right aligned. The title would be rendered one cell too far
to the right.
Addresses part of #738