Fix missing selection change notifications for cut operations#422
Open
Dilrvvr wants to merge 1 commit intosimonbs:mainfrom
Open
Fix missing selection change notifications for cut operations#422Dilrvvr wants to merge 1 commit intosimonbs:mainfrom
Dilrvvr wants to merge 1 commit intosimonbs:mainfrom
Conversation
The cut() method was not notifying inputDelegate about the selection change, unlike paste() which properly calls selectionWillChange/ selectionDidChange. This caused the visual selection highlight to persist after cutting text. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Fixes missing UITextInputDelegate selection change notifications when performing a cut, which could leave the system selection UI (highlight/caret) visually out of sync after the selected text is removed.
Changes:
- Notify
inputDelegatewithselectionWillChange(_:)immediately before cutting (replacing selection with empty string). - Notify
inputDelegatewithselectionDidChange(_:)immediately after the cut replacement completes. - Align
cut(_:)selection notification behavior with the existingpaste(_:)flow.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or 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
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.
Summary
TextInputView.cut(_:)did not notifyinputDelegatewhen the selectionchanged after cutting text.
Because of that, the visual selection highlight could remain visible even
after the selected text had been removed and the selection had collapsed.
Changes
selectionWillChange(_:)before replacing the selected text duringcut(_:)selectionDidChange(_:)after the replacement completescut(_:)behavior with the existing selection notification flowused by
paste(_:)Testing
visual selection highlight
cut operation
Notes
behavior