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

Words with emphasis markup are incorrectly added to the Project Word List #1532

Closed
tmarplatt opened this issue Oct 14, 2023 · 2 comments · Fixed by #1525
Closed

Words with emphasis markup are incorrectly added to the Project Word List #1532

tmarplatt opened this issue Oct 14, 2023 · 2 comments · Fixed by #1525
Assignees
Labels
editor Component: Editor planned Note: Feature planned for a later release usability Issue: Could do with some improvement

Comments

@tmarplatt
Copy link
Contributor

When adding a new word to the Project Word List via context menu in the Editor, if the word is surrounded by emphasis markups, i.e. underscores _, novelWriter adds a new entry in the PWL including any underscore as it appears in the editor, instead of stripping the markup before the addition.

This has the obvious side effect of still detecting the word as a misspell wherever it appears in the editor.

Tested on main branch.

@tmarplatt tmarplatt added the bug Issue: Something isn't working label Oct 14, 2023
@tmarplatt
Copy link
Contributor Author

tmarplatt commented Oct 14, 2023

Also, right now, when you add a new word to the Project Word List from the context menu, if the word is adjacent by novelWriter symbols, specifically any dash, and any character under the Other Symbols entry under the Insert menu.

E.g., adding the word ÷rawr (“rawr” preceded by the division sign as inserted by novelWriter) creates an entry in the PWL without stripping the division sign.

It sounds too close to the current issue for me to create a new one. But it perhaps is like that by design, so then it may just be a feature request? Beats me.

@vkbo
Copy link
Owner

vkbo commented Oct 14, 2023

Yes, the right click action uses Qt's own word selector method to select the word that is added. I have already rewritten this entire logic in PR #1525, so from release 2.2 the spell check errors will be saved as meta data with each paragraph and used for the spell check correction logic that is called by the right click actions.

Both underscore and other symbols are considered as parts of words by the Qt text editor. I have added some post-processing logic to it from previous issue tickets (see #1415), but at the end of the day, rewriting the logic is a better approach than chasing all these corner cases. As far as I can tell, the new logic fixes all of this on a fundamental level by using Unicode word boundary detection via RegEx instead. It also means what is selected and what is underlined will match.

I'll add your ticket to the current PR as that PR will solve the issue, and I'll double check how it handles symbols.

@vkbo vkbo added editor Component: Editor usability Issue: Could do with some improvement planned Note: Feature planned for a later release and removed bug Issue: Something isn't working labels Oct 14, 2023
@vkbo vkbo added this to the Release 2.2 Beta 1 milestone Oct 14, 2023
@vkbo vkbo self-assigned this Oct 14, 2023
@vkbo vkbo mentioned this issue Oct 14, 2023
6 tasks
@vkbo vkbo linked a pull request Oct 14, 2023 that will close this issue
6 tasks
@vkbo vkbo closed this as completed Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor Component: Editor planned Note: Feature planned for a later release usability Issue: Could do with some improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants