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

perf(rect)!: Rect::inner takes Margin directly instead of reference #1008

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

EdJoPaTo
Copy link
Member

@EdJoPaTo EdJoPaTo commented Mar 30, 2024

BREAKING CHANGE: Margin needs to be passed without reference now.

-let area = area.inner(&Margin {
+let area = area.inner(Margin {
     vertical: 0,
     horizontal: 2,
 });

Copy link

codecov bot commented Mar 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.3%. Comparing base (257db62) to head (4b56775).

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #1008   +/-   ##
=====================================
  Coverage   94.3%   94.3%           
=====================================
  Files         61      61           
  Lines      14767   14767           
=====================================
  Hits       13926   13926           
  Misses       841     841           

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

@joshka joshka changed the title perf(rect): const and copy Margin instead of ref perf(rect)!: const and copy Margin instead of ref Mar 31, 2024
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.

LGTM as a breaking change

  • Update the PR message to be changelog focused (e.g. tell the user how they need to change their apps.) Something like "Rect::inner() now takes Margin instead of &Margin"
  • Add the info to the breaking change doc
  • Add the breaking change section of the commit (https://www.conventionalcommits.org/)
  • Make sure there's a small example of how to fix the change in both places (this is overkill for such a small change, but doing it consistently makes it easy for users upgrading to search for this sort of thing easily)

Hold off merging until 0.27.0 release is ready to go after 0.26.2

@joshka joshka added this to the v0.27.0 milestone Mar 31, 2024
@EdJoPaTo EdJoPaTo changed the title perf(rect)!: const and copy Margin instead of ref perf(rect)!: Rect::inner takes Margin directly instead of reference Apr 3, 2024
@EdJoPaTo EdJoPaTo changed the title perf(rect)!: Rect::inner takes Margin directly instead of reference perf(rect)!: Rect::inner takes Margin directly instead of reference Apr 10, 2024
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.

Changes look good. We can merge this when we go to 0.27.0

I think the next version will probably be 0.26.2 and then have all breaking changes batched up in 0.27.0

@orhun

This comment was marked as outdated.

@joshka

This comment was marked as outdated.

@joshka
Copy link
Member

joshka commented Apr 25, 2024

BTW, I expect this will probably break a lot of projects (520 results):

https://github.com/search?q=ratatui+%22.inner%28%22+AND+%28NOT+org%3Aratatui-org%29+AND+%28NOT+is%3Afork%29&type=code

@kdheepak
Copy link
Collaborator

I'd like for this change to be made because it'll make it consistent with a future feature like: #931

@joshka
Copy link
Member

joshka commented Apr 26, 2024

I'd like for this change to be made because it'll make it consistent with a future feature like: #931

Sounds like we should break both things at the same time to avoid double breaks.

Also, adds `Rect::ZERO` and `Rect::inner` is now `const`.

BREAKING CHANGE: `Margin` needs to be passed without reference now.
@joshka

This comment was marked as outdated.

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

Successfully merging this pull request may close these issues.

None yet

4 participants