Thursday, November 30, 2017

Why the Selection Changes When You Do Syntax Highlighting in a NSTextView

Christian Tietze:

In short: when you type and the attributes of the line change, the insertion point is moved to the end of the line. That sucks.

TL;DR: Do not perform style changes inside of NSTextStorage.processEditing() or NSTextStorageDelegate methods but subscribe to NSText.didChangeNotification or NSTextDelegate or NSTextViewDelegate.textDidChange(_:).

Comments RSS · Twitter

Leave a Comment