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

fix(block): make inner aware of title positions #657

Merged
merged 1 commit into from
Dec 3, 2023
Merged

fix(block): make inner aware of title positions #657

merged 1 commit into from
Dec 3, 2023

Conversation

jan-ferdinand
Copy link
Contributor

@jan-ferdinand jan-ferdinand commented Dec 2, 2023

Previously, when computing the inner rendering area of a block, all titles were assumed to be positioned at the top. If some or all titles were at the bottom, this caused various incorrect computations of the inner area, depending on which borders were set; no border at the bottom would lead to an area that's too big, no border at the top but at the bottom and all titles at the bottom would lead to an area that's too small.

Now, when computing the inner area, the positions of the titles are taken into account.

fix #658

Copy link

codecov bot commented Dec 2, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (1229b96) 90.7% compared to head (40b7a6b) 90.7%.
Report is 2 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main    #657   +/-   ##
=====================================
  Coverage   90.7%   90.7%           
=====================================
  Files         42      42           
  Lines      12170   12249   +79     
=====================================
+ Hits       11042   11121   +79     
  Misses      1128    1128           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Sponsor Member

@orhun orhun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add a test case where you cover the issue in #658? (you can assert the contents of the buffer with assert_buffer)

@jan-ferdinand
Copy link
Contributor Author

add a test case where you cover the issue in #658

Good suggestion. I have amended the PR accordingly. Let me know if anything can be improved. ☺️

Copy link
Member

@joshka joshka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please suggest a simple and concise explanation of the bug?
If you're able, add it to the body of a commit message to make it automatically fill the changelog. If not, we can add the wording when squashing the commit.

src/widgets/block.rs Outdated Show resolved Hide resolved
@jan-ferdinand
Copy link
Contributor Author

I have added an explanation of the bug and the fix to both the description of this PR and the commit message. Let me know should brevity be lacking, or if the level of detail could be improved upon (in either direction).

Also, I have reworked the part that @joshka had a nit about, without accepting the suggestion. If you prefer to have your suggestion exactly, I'll incorporate that instead.

@joshka
Copy link
Member

joshka commented Dec 3, 2023

Possible more brevity would be helpful (to avoid fatigue when reading a changelog), but what you have is also fine if you'd like it. Happy to merge as-is or take your changes if you want to put them.

Previously, when computing the inner rendering area of a block, all
titles were assumed to be positioned at the top, which caused the
height of the inner area to be miscalculated.

Previously, when computing the inner rendering area of a block, all
titles were assumed to be positioned at the top, which caused the
height of the inner area to be miscalculated.
@jan-ferdinand
Copy link
Contributor Author

Thanks for the shortened bug description as well as the improved code snippet. 👍 I've incorporated both and amended the PR accordingly.

@orhun orhun merged commit 56fc410 into ratatui-org:main Dec 3, 2023
33 checks passed
@orhun
Copy link
Sponsor Member

orhun commented Dec 3, 2023

Thanks for your contribution!

@jan-ferdinand jan-ferdinand deleted the fix_block_inner branch December 3, 2023 19:22
@jan-ferdinand
Copy link
Contributor Author

Thanks for the guidance to get this merged smoothly. 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants