You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use RichTextKit for syntax highlighting where the NSAttributedString needs to be updated frequently (e.g., on each keystroke). The current setAttributedString implementation causes the text selection to be lost, with the cursor jumping to the end of the text after every keystroke. This made the editor unusable.
This appears to be a recent regression as this behavior didn't occur in previous versions. I haven't tracked down which update broke it.
(Granted, resetting the NSAttributedString on every keystroke may not have been a foreseen use case - but the system is more than performant enough for it. It's completely smooth. And it used to work)
To continue supporting syntax highlighting I have this workaround, which saves & restores the selection when setting the NSAttributedString:
It works perfectly - typing and syntax highlighting are smooth again. I suggest building that functionality into the base case.
note: it did not work to simply save/restore the selectedRange in my App code, before/after calling setAttributedString, the action publishing system created timing issues which overrode my setting of the selectedRange
The text was updated successfully, but these errors were encountered:
I use RichTextKit for syntax highlighting where the NSAttributedString needs to be updated frequently (e.g., on each keystroke). The current setAttributedString implementation causes the text selection to be lost, with the cursor jumping to the end of the text after every keystroke. This made the editor unusable.
This appears to be a recent regression as this behavior didn't occur in previous versions. I haven't tracked down which update broke it.
(Granted, resetting the NSAttributedString on every keystroke may not have been a foreseen use case - but the system is more than performant enough for it. It's completely smooth. And it used to work)
To continue supporting syntax highlighting I have this workaround, which saves & restores the selection when setting the NSAttributedString:
It works perfectly - typing and syntax highlighting are smooth again. I suggest building that functionality into the base case.
note: it did not work to simply save/restore the selectedRange in my App code, before/after calling
setAttributedString
, the action publishing system created timing issues which overrode my setting of the selectedRangeThe text was updated successfully, but these errors were encountered: