Closed gzigzigzeo closed 4 months ago
We intentionally keep the error simple as these types of questions are dependent on where you are rendering to and how they handle different unicode characters, as well as keeping the dep tree small.
If you'd like to discuss this further, feel free to create an issue. In general, I recommend issues for non-trivial changes for discussing the solution space and encourage PRs only for reviewing an implementation.
Thanks, will open an issue then.
Problem
Given we have the following string:
Let's say that
\*
represents an invalid sequence. By default^
error symbol would be misplaced in the standard output:This happens because symbols like
δΈηπ
have double width in fixed width fonts.The more emojis precede an error, the more the error pointer shifts. It is confusing, especially if errors are displayed to the end user.
Solution
Adds
unicode-width
feature, which calculates correct offset usingunicode-width
crate.Thank you for this great crate!