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: resolve issue with prev-grapheme-cluster-break function #1431

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Shashankss1205
Copy link
Contributor

@Shashankss1205 Shashankss1205 commented Mar 1, 2024

Resolves #1092 .

Description

What is the purpose of this pull request?

There's an issue with prevGraphemeClusterBreak package, if I compare the results with nextGraphemeClusterBreak for a single skin tone emoji it doesn't return the same values,

prevGraphemeClusterBreak( '👉🏿' ) // returns 1
nextGraphemeClusterBreak( '👉🏿' ) // returns -1

Related Issues

Does this pull request have any related issues?

This pull request:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.


@stdlib-js/reviewers

Copy link
Contributor

@stdlib-bot stdlib-bot left a comment

Choose a reason for hiding this comment

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

👋 Hi there! 👋

And thank you for opening your first pull request! We will review it shortly. 🏃 💨

@Shashankss1205
Copy link
Contributor Author

@kgryte , @Pranavchiku, @Planeshifter Please check the integrity of this PR, and send reviews

@kgryte kgryte added the Needs Review A pull request which needs code review. label Mar 9, 2024
@@ -99,7 +99,9 @@ function prevGraphemeClusterBreak( str, fromIndex ) {

// Get the corresponding grapheme break and emoji properties:
breaks.push( breakProperty( cp ) );
emoji.push( emojiProperty( cp ) );
if (!(cp >= 0x1F3FB && cp <= 0x1F3FF)) { // Check if the character is not a skin tone modifier
Copy link
Member

Choose a reason for hiding this comment

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

This is too narrow a patch. It is not just skin tones, TMK, but any modifier. The implementation more generally should be refactored to ensure that grapheme clusters comprised of multiple code points are handled correctly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh I am sorry, I got confused by seeing the original issue being raised about the colour tone.
I will try to debug and propose a generic solution to this as soon as possible.
Thank You.

@@ -114,7 +116,9 @@ function prevGraphemeClusterBreak( str, fromIndex ) {

// Get the corresponding grapheme break and emoji properties:
breaks.push( breakProperty( cp ) );
emoji.push( emojiProperty( cp ) );
if (!(cp >= 0x1F3FB && cp <= 0x1F3FF)) { // Check if the character is not a skin tone modifier
Copy link
Member

Choose a reason for hiding this comment

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

Same comment as above.

@kgryte kgryte added the Needs Changes Pull request which needs changes before being merged. label Mar 9, 2024
@kgryte kgryte added Needs Changes Pull request which needs changes before being merged. and removed Needs Changes Pull request which needs changes before being merged. Needs Review A pull request which needs code review. labels Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Changes Pull request which needs changes before being merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug with skin tone emojis when using prevGraphemeClusterBreak package
3 participants