-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[macOS] Show correction panel for grammar errors #10986
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EWS run on previous version of this PR (hash 89571a3) |
EWS run on current version of this PR (hash 2d3629b) |
whsieh
approved these changes
Mar 3, 2023
Thanks for the review! |
https://bugs.webkit.org/show_bug.cgi?id=253294 rdar://105738781 Reviewed by Wenson Hsieh. Native text views on macOS display a correction panel when grammar checking is enabled and the cursor is at the end of a grammar error, or when at the end of a misspelled word. Currently, WebKit only implements this behavior for misspelled words. This patch adds support for showing a correction panel for grammar errors, matching AppKit behavior. * Source/WebCore/editing/AlternativeTextController.cpp: (WebCore::AlternativeTextController::timerFired): Obtain suggestions for an ungrammatical phrase. (WebCore::AlternativeTextController::handleAlternativeTextUIResult): Insert accepted suggestions the same way as spelling suggestions. (WebCore::AlternativeTextController::shouldStartTimerFor const): Add grammar markers to the allowlist of markers that can display alternative text. Improve the readability of the method by using a switch statement. (WebCore::AlternativeTextController::respondToMarkerAtEndOfWord): Start the timer to get grammar suggestions for the current word. * Source/WebCore/page/AlternativeTextClient.h: * Source/WebKit/UIProcess/mac/CorrectionPanel.mm: (correctionIndicatorType): The correction panel for grammar suggestions should appear the same as the panel for spelling suggestions. * Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.cpp: (WebKit::WebEditorClient::shouldEraseMarkersAfterChangeSelection const): Prevent grammar markers from being removed on selection changes, matching native behavior. * Source/WebKitLegacy/mac/WebCoreSupport/CorrectionPanel.mm: (correctionIndicatorType): The correction panel for grammar suggestions should appear the same as the panel for spelling suggestions. Canonical link: https://commits.webkit.org/261151@main
2d3629b
to
8172768
Compare
Committed 261151@main (8172768): https://commits.webkit.org/261151@main Reviewed commits have been landed. Closing PR #10986 and removing active labels. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
8172768
2d3629b
π§ͺ ios-wk2π§ͺ api-macπ§ͺ api-iosπ tvπ§ͺ api-gtk