rajdeep / proton

Purely native and extensible rich text editor for iOS and macOS Catalyst apps
Other
1.28k stars 82 forks source link

More UndoRedo #317

Open easiwriter opened 4 months ago

easiwriter commented 4 months ago

UndoRedo is working OK now. But selection changes are not being notified to the delegate anymore. I traced through your code and it ends up in a null delegate method in an extension. Also tapping on any text brings up the edit menu popup. I assume these things are due to incomplete changes in your code?

rajdeep commented 4 months ago

@easiwriter, it might be because of what I highlighted earlier as an improvement that I have in my backlog. I am not sure though as to how soon I'll be able to get to it but will try to prioritize that. Are you able to provide more details about which delegate you're finding nil?

easiwriter commented 4 months ago

Here's the call sequence:

`

6 0x000000010bde5605 in @objc RichTextViewContext.textViewDidChangeSelection(_:) ()

7 0x00007ff806155831 in -[UITextView textInputDidChangeSelection:] ()

8 0x00007ff806120a4d in -[UITextInputController _sendDelegateChangeNotificationsForText:selection:] ()

9 0x00007ff80612233f in __46-[UITextInputController setSelectedTextRange:]_block_invoke.577 ()

10 0x00007ff806122704 in __52-[UITextInputController _coordinateSelectionChange:]_block_invoke ()

11 0x00007ff804c024fb in -[NSTextStorage coordinateReading:] ()

12 0x00007ff80612266f in -[UITextInputController _coordinateSelectionChange:] ()

13 0x00007ff80612208e in -[UITextInputController setSelectedTextRange:] ()

14 0x00007ff8061224cd in -[UITextInputController setSelectedRange:] ()

15 0x00007ff8061565e8 in -[UITextView setSelectedRange:] ()

16 0x00007ff80614975f in -[UITextView setAttributedText:] ()

17 0x000000010bdd16d4 in RichTextView.attributedText.setter ()

18 0x000000010bdd1655 in @objc RichTextView.attributedText.setter ()

19 0x000000010bdf527b in EditorView.attributedText.setter at `

And the delegate is here along with a load of other null methods at line 141:

public extension EditorViewDelegate { func editor(_ editor: EditorView, shouldHandle key: EditorKey, modifierFlags: UIKeyModifierFlags, at range: NSRange, handled: inout Bool) { } func editor(_ editor: EditorView, didReceiveKey key: EditorKey, at range: NSRange) { } func editor(_ editor: EditorView, didReceiveFocusAt range: NSRange) { } func editor(_ editor: EditorView, didLoseFocusFrom range: NSRange) { } func editor(_ editor: EditorView, didChangeTextAt range: NSRange) { } func editor(_ editor: EditorView, didChangeSelectionAt range: NSRange, attributes: [NSAttributedString.Key: Any], contentType: EditorContent.Name) { } func editor(_ editor: EditorView, didExecuteProcessors processors: [TextProcessing], at range: NSRange) { } func editor(_ editor: EditorView, didChangeSize currentSize: CGSize, previousSize: CGSize) { } func editor(_ editor: EditorView, didTapAtLocation location: CGPoint, characterRange: NSRange?) { } func editor(_ editor: EditorView, didLayout content: NSAttributedString) { } func editor(_ editor: EditorView, willSetAttributedText attributedText: NSAttributedString, isDeferred: Bool) { } func editor(_ editor: EditorView, didSetAttributedText attributedText: NSAttributedString, isDeferred: Bool) { } func editor(_ editor: EditorView, isReady: Bool) { } func editor(_ editor: EditorView, didChangeEditable isEditable: Bool) { } func editor(_ editor: EditorView, didRenderAttachment attachment: Attachment) { } func editor(_ editor: EditorView, shouldSelectAttachmentOnBackspace attachment: Attachment) -> Bool? { return nil } func editor(_ editor: EditorView, didChangeBackgroundColor color: UIColor?, oldColor: UIColor?) { } }