Fix #520 Red underline upon sentence completion #679
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.
Addresses #520
This PR addresses spellcheck highlighting at the ends of sentences when a valid word is followed by a period, and alters the existing special handling around words that contain periods.
~
Issue:
Valid words were being erroneously flagged by the spellchecker when followed by a period.
Reproduction on OpenBoard 1.4.5
~
Resolution:
Valid words followed by periods are no longer flagged. Invalid words followed by periods are still flagged, and the intent behind the existing logic to flag and suggest valid words on either side of a period within a token should not be impacted by this change (see below).
Testing on Pixel 5 Android 13
Valid words on either side of an interceding period are suggested with a space as separator
~
Additional Considerations for CHECKABILITY_CONTAINS_PERIOD:
Empty words are considered invalid. In CHECKABILITY_CONTAINS_PERIOD, when a period was the first or last index of text, splitting that text on periods caused suggestions to consider potentially valid words to be invalid. For example, "this.example." should suggest "this example" or "this example.", but no suggestions were being given due to the trailing empty string resulting from the split operation being considered invalid. This PR modifies this behavior such that empty split tokens will not be considered toward word validity when generating suggestions for text containing periods.
Single word sentences (like "Groovy.") were being flagged as invalid since the word only exists in the main dictionary as lower case, but the validity check within CHECKABILITY_CONTAINS_PERIOD sent text over as is. This PR adds, specific to the period checkability logic, a fallback validity check for words set to lower case.