-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
[iOS] Remove selectionDidChange call in UndoManager #45657
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,9 +104,11 @@ - (void)setUndoState:(NSDictionary*)dictionary API_AVAILABLE(ios(9.0)) { | |
// This is needed to notify the iPadOS keyboard that it needs to update the | ||
// state of the UIBarButtons. Otherwise, the state changes to NSUndoManager | ||
// will not show up until the next keystroke (or other trigger). | ||
id<UITextInputDelegate> inputDelegate = | ||
_viewController.engine.textInputPlugin.textInputView.inputDelegate; | ||
[inputDelegate selectionDidChange:_viewController.engine.textInputPlugin.textInputView]; | ||
UITextInputAssistantItem* assistantItem = | ||
_viewController.engine.textInputPlugin.textInputView.inputAssistantItem; | ||
NSArray<UIBarButtonItemGroup*>* leadingGroups = assistantItem.leadingBarButtonGroups; | ||
assistantItem.leadingBarButtonGroups = @[]; | ||
assistantItem.leadingBarButtonGroups = leadingGroups; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hy is it setting There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was a workaround to notify the iPadOS keyboard to update the state of these buttons. It's been awhile, but I believe the behavior I was seeing was that state changes to canUndo/canRedo would not show up until the next keypress – so if I press a letter, the undo button should light up, but it won't until I press another key. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Worth trying if it works if we simply do There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BTW if it's iOS 17 related, feel free to contribute to the design doc which already discusses about several iOS 17 text input issues. It can be a good reference doc for future developers. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the original issue is reproduced on an iOS 16 device so probably not ios specific. I tested removing the intermediate empty array step it appears the setter indeed doesn't skip even when given the same array instance. Updated. I'll file a radar later since the keyboard could just rely on notifications to properly update the undo/redo UI. |
||
} | ||
[self undoManager].groupsByEvent = groupsByEvent; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this comment still relevant?