Fix circleQuestionMark
and questionMarkPrefix
on Linux
#98
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current intent of the
circleQuestionMark
andquestionMarkPrefix
symbols is to be displayed as circled question marks.Unlike other symbols, this has an additional problem: this is not displayed correctly on some Linux distributions (like Ubuntu) but is displayed correctly on macOS.
The current logic has several problems. First, the condition
platform === 'linux'
should be inverted, since it currently shows the circled question mark only on Linux, instead of not on Linux.figures/index.js
Lines 203 to 214 in 32fb096
Second, it leads
replaceSymbols()
to replace any normal question mark?
to(?)
. That's becausereplaceSymbols()
was designed to replace symbols that are easily recognized as "graphical/UI" characters like✔
or◀
. But?
can be a normal punctuation character, which should not be replaced.We could use
(?)
instead of?
as a non-fallback character on Linux, but that removes the ability ofreplaceSymbols()
to replace circled question marks to(?)
, at least with the current implementation ofreplaceSymbols()
.Sorry if this description is a little confusing. In a nutshell, this module is currently mostly using
is-unicode-supported
as a switch between fallback and non-fallback characters, and the current logic does not support well OS-specific characters. I initially considered adding a better support for OS-specific characters, but this is more complex that one might think. It appears the simplest solution is to just change thecircleQuestionMark
andquestionMarkPrefix
symbols.Please note that CI tests on the
main
branch were failing due to this.This PR implements the following fix:
circleQuestionMark
andquestionMarkPrefix
symbols are now always displayed as(?)
. Before they were displayed as circled question marks on macOS. I am not sure whether this should be considered a breaking change or not.