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

Spell check #355

Merged
merged 4 commits into from
Aug 4, 2024
Merged

Conversation

windymilla
Copy link
Collaborator

  1. If user has selected text, spell check will just check the selected words (or part words if word is not wholly within selection). Note that GG1 Spell Query does not have this feature, but Spell Check does.

  2. If word appears more times in the file than the threshold value, it is assumed to be a good spelling and so is not reported - this is the same as GG1's Spell Query but Spell Check does not have this.

.

@windymilla
Copy link
Collaborator Author

Question for @srjfoo:

If you run the spell checker in GG2, it lists the spelling errors, and chooses the first error (or the user can choose any error) which then selects that word in the main text window. If you decide you want to adjust the threshold and re-run, then now it only rechecks that one word (because it is selected and we have just made spell check only check the selection if there is one.
That seems a bit annoying (at least it was to me) because it's almost certainly not what you intended. If you had previously selected a region to spell check, then you probably want to re-check that region. If you previously spell checked the whole file, you probably want to re-check the whole file.

Any good ideas of how to make it more helpful?

My best idea so far (which would need to wait until #351 is merged, with its "restore selection" feature) - probably more accurate to describe the comments below as a brain dump / random thoughts:
Save the selection (if any) immediately before doing the spell check. When using "re-run" do a "restore selection" immediately before re-running. The re-run would then work on the same section of text as the initial run.
Disadvantage: Consider this case - user does spell check on whole file, then realizes they meant to only spell check a selection, so they make a selection and re-run. The reverse case (accidentally only spellchecking a selection, then attempting to re-run with no selection to spell check everything) would also go wrong. With the above idea, re-running would override their selection/de-selection.
Fix? If user makes a selection (including selecting nothing), then clear the #351 saved selection

If user has selected text, spell check will just check the
selected words (or part words if word is not wholly within
selection).
If word appears more times in the file than the threshold
value, it is assumed to be a good spelling and so is not
reported - this is the same as GG1's behavior.
When spell check (or other tools) want to highlight a
word in the main text window, use a new tag (spotlight)
instead of the default system selection.
This is more similar to the way GG1 works, and eliminates
problems with having an unwanted selection that
clashes with re-running tools like spell check.
@windymilla
Copy link
Collaborator Author

@srjfoo - I've pushed another commit that uses the "alternative selection"/"highlighting" idea instead of the main selection mechanism when highlighting a word due to a click in a checker tool (also in WF). The color (orange) is the same as GG1.
This fixes the "spell check a selection, then re-run" problem.

Question: Would it be better if the selected words in the dialog were also in orange? I tried it, and having lots of orange was a bit overwhelming, so I've currently left them in the default selection color. Here's a screen shot of all orange compared with leaving it blue.

image

image

@windymilla windymilla linked an issue Aug 2, 2024 that may be closed by this pull request
@srjfoo
Copy link
Member

srjfoo commented Aug 4, 2024

For what it's worth, this is what I see, (I assume) because my selection is still active. So, somewhat different from what you see. However, I agree with you. I'd rather the highlighting in the spellcheck results stay the user's system default. (believe it or not, I'm not really all that fond of pink 😁)

image

I don't know if you're seeing this on Windows, but I am on macOS: When re-running spell check (whether for a changed threshold or a different selection), the count in the upper-left-hand corner is set to "0 Entries" between the old results display and the new. I doubt that anyone (after the first time) will misinterpret it, because the spell check does finish and you have a final count.

My first thought was to leave that area blank while the script is working, but it probably makes more sense to either display something like a ... or the working message that's displayed in the main window. My thinking is that the PPer is probably going to be focused on the spell check widget, not on the bottom right-hand corner of the main text window. (You are, of course, welcome to ignore both suggestions -- or punt on the issue. 😁)

COLORS_SPOTLIGHT = {
"Light": {"bg": "orange", "fg": "black"},
"Dark": {"bg": "orange", "fg": "white"},
"Default": {"bg": "orange", "fg": "black"},
Copy link
Member

Choose a reason for hiding this comment

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

Aaah, this is why I see black text on orange in the main text window. :D

Black looks fine on orange, which is a good reason to choose a color that black and white are equally readable on, because otherwise, fancy footwork would be needed with the default theme.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

See additional color notes in #353 relating to "fancy footwork" for default theme.

@windymilla windymilla merged commit 0b78f0b into DistributedProofreaders:master Aug 4, 2024
1 check passed
@windymilla windymilla deleted the spell-check branch August 4, 2024 15:31
@windymilla
Copy link
Collaborator Author

the count in the upper-left-hand corner is set to "0 Entries" between the old results display and the new

I've added #364 to tackle this

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.

Spell Check does not work like GG1
2 participants