Thursday, November 30, 2017 [Tweets] [Favorites]

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

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment