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

Add useFallback option #101

Merged
merged 7 commits into from
Mar 4, 2024
Merged

Add useFallback option #101

merged 7 commits into from
Mar 4, 2024

Conversation

ehmicky
Copy link
Collaborator

@ehmicky ehmicky commented Mar 2, 2024

Fixes #100.

@sindresorhus
Copy link
Owner

What's the thinking of having it as a separate method rather than an option for replaceSymbols()? Just curious.

@ehmicky ehmicky force-pushed the force-fallback branch 2 times, most recently from 3f9e1a7 to bd7aeb0 Compare March 3, 2024 17:17
@ehmicky ehmicky changed the title Add forceFallbackSymbols() method Add useFallback option Mar 3, 2024
@ehmicky
Copy link
Collaborator Author

ehmicky commented Mar 3, 2024

Not thinking about it! That's a better idea. :)

I updated the PR to use a useFallback boolean option instead. Please let me know if the name should be changed.

readme.md Outdated
Comment on lines 37 to 34
// On terminals with Unicode symbols: √︎ check
// On other terminals: √ check
Copy link
Owner

Choose a reason for hiding this comment

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

Shouldn't these two show the same symbol since it's using the fallback no matter what?

Copy link
Collaborator Author

@ehmicky ehmicky Mar 3, 2024

Choose a reason for hiding this comment

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

Those two lines show the same symbol (the fallback one).

readme.md Outdated Show resolved Hide resolved
readme.md Outdated Show resolved Hide resolved
@ehmicky ehmicky requested a review from sindresorhus March 3, 2024 18:17
@sindresorhus
Copy link
Owner

The symbols look different to me:

Screenshot 2024-03-04 at 12 42 07

@ehmicky
Copy link
Collaborator Author

ehmicky commented Mar 4, 2024

Interesting. I am wondering whether we are looking at different sections. 🤔

Are those the ones in the main example section? Those should be different. The example in the TypeScript types should also show two different symbols.

On the other hand, the symbols in the example section for useFallback use the same Unicode codepoint in my text editor (U-221a). They display like so on Firefox:

Screenshot from 2024-03-04 06-29-29

@sindresorhus
Copy link
Owner

sindresorhus commented Mar 4, 2024

This is what I see: (Safari, macOS)

Screenshot 2024-03-04 at 13 48 41

@ehmicky
Copy link
Collaborator Author

ehmicky commented Mar 4, 2024

Wow, this challenged my sanity but I figured it out.

The first symbol was a single character with two codepoints: U+221a (tick) followed by U+FE0E (variation selection 15). Since the variation selector changes the aspect of the tick, both codepoints formed a single character.

On VSCode, when I looked up the unicode codepoint, it only showed me the first codepoint. But I used hexdump and saw the actual UTF-8 encoded codepoints.

I checked the other files, and it only happened in this example, and its copy in index.test-d.ts.

What happened is: the non-fallback tick is U+2714 followed by U+FE0E in the documentation (not the source code, I opened #102 to fix that). I ended up copying the variation selection around by mistake due to copy pasting.

So this is now fixed in b051c4e. 🪄

@ehmicky ehmicky force-pushed the force-fallback branch 3 times, most recently from b7ac882 to 0d166ba Compare March 4, 2024 18:40
@ehmicky
Copy link
Collaborator Author

ehmicky commented Mar 4, 2024

Fixed merged conflict.

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.

Add replacement method for automated tests
2 participants