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 bug in str_trunc() with simpler code #515

Merged
merged 3 commits into from
Aug 5, 2023

Conversation

UchidaMizuki
Copy link
Contributor

Fix #512 .
This is a pull request similar to #513 .

#512 is caused by the boundary cases of stringi::stri_sub() when getting the end of a string.
gagolews/stringi#494

I modified the code to avoid the boundary cases, i.e., from is always a positive number, and added tests.
I think this proposal can fix the bug with simpler code than #513 .

@eauleaf
Copy link

eauleaf commented Jul 7, 2023

Yeah, this fix is cleaner. Looked at speed; they're equivalent.

Copy link
Member

@hadley hadley left a comment

Choose a reason for hiding this comment

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

Thanks for working on this! Can you please add a bullet to the top of NEWS.md? It should briefly describe the change and end with (@yourname, #issuenumber).

@UchidaMizuki
Copy link
Contributor Author

I have updated NEWS.md. Please check it.

NEWS.md Outdated
@@ -4,6 +4,9 @@

## Breaking changes

* `str_trunc()` now correctly truncates strings when `side` is `"left"` or
Copy link
Member

Choose a reason for hiding this comment

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

Can you please put this in the news for the development version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry for the mistake. I just fixed it.

@hadley hadley merged commit 08ff36f into tidyverse:main Aug 5, 2023
12 checks passed
@hadley
Copy link
Member

hadley commented Aug 5, 2023

Thanks!

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.

str_trunc() incorrectly snips rhs-of-ellipsis for truncated strings
3 participants