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

refactor(layout): simplify and doc split() #405

Merged
merged 2 commits into from
Aug 17, 2023
Merged

Conversation

joshka
Copy link
Member

@joshka joshka commented Aug 16, 2023

This is mainly a reduction in density of the code with a goal of
improving mainatainability so that the algorithm is clear.

(Testing - the layout example renders the same)

@codecov
Copy link

codecov bot commented Aug 16, 2023

Codecov Report

Merging #405 (0fdec45) into main (418ed20) will increase coverage by 0.73%.
Report is 1 commits behind head on main.
The diff coverage is 100.00%.

❗ Current head 0fdec45 differs from pull request most recent head 1b0be84. Consider uploading reports for the commit 1b0be84 to get more accurate results

@@            Coverage Diff             @@
##             main     #405      +/-   ##
==========================================
+ Coverage   85.36%   86.09%   +0.73%     
==========================================
  Files          40       40              
  Lines        8853     9221     +368     
==========================================
+ Hits         7557     7939     +382     
+ Misses       1296     1282      -14     
Files Changed Coverage Δ
src/backend/test.rs 43.63% <ø> (ø)
src/layout.rs 96.28% <100.00%> (+7.19%) ⬆️

@joshka
Copy link
Member Author

joshka commented Aug 16, 2023

Pinging @hasezoey for 👀 and 💭 on this.

@joshka
Copy link
Member Author

joshka commented Aug 17, 2023

Thanks for the review comments @hasezoey. I've updated the comments to better explain the testing approach (and removed a couple of comments that were accidentally left in while testing the rounding fix)

@joshka joshka requested a review from hasezoey August 17, 2023 01:15
src/layout.rs Outdated Show resolved Hide resolved
src/layout.rs Outdated Show resolved Hide resolved
src/layout.rs Outdated Show resolved Hide resolved
@joshka joshka force-pushed the layout-docs branch 2 times, most recently from f31f8c9 to 4834f05 Compare August 17, 2023 04:04
src/layout.rs Outdated Show resolved Hide resolved
@joshka
Copy link
Member Author

joshka commented Aug 17, 2023

Incoming push makes Element one dimensional (just start, end and size()), which simplifies a bunch of this even more based @kdheepak's suggestion at #405 (comment)

I also moved the tests prior to the refactor commit to show that they apply equally to the existing code and the refactored code.

src/layout.rs Outdated Show resolved Hide resolved
src/layout.rs Outdated Show resolved Hide resolved
@kdheepak
Copy link
Collaborator

Sorry about the staged second round of comments! This looks great now btw!

Copy link
Collaborator

@kdheepak kdheepak left a comment

Choose a reason for hiding this comment

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

LGTM!

This is mainly a reduction in density of the code with a goal of
improving mainatainability so that the algorithm is clear.
@joshka joshka added this pull request to the merge queue Aug 17, 2023
Merged via the queue into ratatui:main with commit de25de0 Aug 17, 2023
@joshka joshka deleted the layout-docs branch August 17, 2023 07:44
@joshka joshka added this to the v0.23.0 milestone Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants