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

Bug: Spellings correction uses wronge replacement positions when using special character (') single quote #1101

Closed
Anynomouss opened this issue Apr 14, 2024 · 2 comments
Assignees
Labels

Comments

@Anynomouss
Copy link

Anynomouss commented Apr 14, 2024

Example text:
'Text' using four 'single-quotes', results in an erroneous underlining and spellings correction and should be fixed where possibleible, right click will suggest to change possibleible to possible.

I only noticed this problem in a certain section of my document so I did some further investigation . It turned out to be the use of single quotes ('), see the example text provided above. I had four single quotes in my text that turned out not to be counted when underlining a wrongfully spelled words, resulting in a shift to the left. When I removed 2 out of 4 of these (') the shift was only 2, when I removed them altogether, replacement worked like normal, confirming the problem occurred when using (') in text.

Solution
Solution: Depends on how you implemented this. Perhaps you use a parsed format of the text where characters like (') are removed before feeding the text to the spellings correction library. I checked all characters on my keyboard and for me it only appears to happen when using (') single quote characters, but perhaps you can double check which characters are replaced in the code.

  1. Use a string replacements or search to find the correct location of a to be underlined word/string.
  2. Count the replacements characters in the text up to the point of the to be underlined string and add these to the location given by the text corrector.

A free Markdown Monster subscriptions is appreciated ;)

@Anynomouss Anynomouss changed the title Spellings correction uses a wronge replacement lenght when using special character (') single quote Spellings correction uses wronge replacement positions when using special character (') single quote Apr 16, 2024
@Anynomouss Anynomouss changed the title Spellings correction uses wronge replacement positions when using special character (') single quote Bug: Spellings correction uses wronge replacement positions when using special character (') single quote Apr 16, 2024
@RickStrahl RickStrahl self-assigned this Apr 24, 2024
@RickStrahl RickStrahl added the bug label Apr 24, 2024
@RickStrahl
Copy link
Owner

Whoa good catch! This has been around for a while but I've never put it together that it was based on the quotes.

Looks like any quote offsets the misspelling underline to the left. Looks like the counter is skipping quotes.

I'll take a look.

@RickStrahl
Copy link
Owner

Ok found the issue. Looks like it's working now:

image

This will also now work with double quotes (didn't before).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants