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 padding functions #254

Merged
merged 1 commit into from Jan 31, 2024

Conversation

mikelorant
Copy link
Contributor

The padLeft and padRight functions were nearly identical and could benefit from being refactored to share common code.

A new function called pad was added that applies padding based on the sign of the amount of padding needed. A positive value applies padding to the right side while a negative value applies padding to the left side.

Issue: #252

@mikelorant
Copy link
Contributor Author

@meowgorithm Can I get approval to run the workflows? Thanks.

@meowgorithm
Copy link
Member

Done. Nice work on this one.

@mikelorant
Copy link
Contributor Author

Can I get someone from @charmbracelet to review this. Thanks.

@meowgorithm
Copy link
Member

Good call on consolidating the two functions. If I'm reading this correctly negative integers applied to pad pad the left side, while positive integers pad the right, correct?

@mikelorant
Copy link
Contributor Author

If I'm reading this correctly negative integers applied to pad pad the left side, while positive integers pad the right, correct?

Yes, you reading this correctly.

I am doing the conflict resolution now and will have this updated shortly.

@mikelorant mikelorant force-pushed the refactor/padding branch 3 times, most recently from 98a6610 to 16756d2 Compare January 30, 2024 23:09
The `padLeft` and `padRight` functions were nearly identical and could
benefit from being refactored to share common code.

A new function called `pad` was added that applies padding based on the
sign of the amount of padding needed. A positive value applies padding
to the right side while a negative value applies padding to the left
side.

Issue: charmbracelet#252
Signed-off-by: Michael Lorant <michael.lorant@nine.com.au>
@mikelorant
Copy link
Contributor Author

Added function comment to explain the relationship between positive and negative values.

@mikelorant
Copy link
Contributor Author

@meowgorithm Any improvements or changes you'd like to make?

@meowgorithm
Copy link
Member

Looking good, @mikelorant—let's get it done. Thanks for the attention to detail!

@meowgorithm meowgorithm merged commit 92946d3 into charmbracelet:master Jan 31, 2024
9 checks passed
@mikelorant mikelorant deleted the refactor/padding branch January 31, 2024 04:01
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.

None yet

2 participants