KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Possible Duplicate: Syntax coloring for Cocoa app I'm interested in syntax highlighting in a Cocoa TextView. I found several resources: approach with flex , via a flex pattern matched against textStorageDidProcessEditing in a TextView delegate. In this approach the whole string get parsed on each input event, hence performance degrades. CocoaDev has an own page on the topic of syntax highlighting : Use NSTextStorageDidProcessEditingNotification , then get the edited range, and just apply the coloring there. The range might be wordboundaries or anything; this definitely improves performance. Mentioned there: Xcode, for example, only colorizes text that's currently on-screen, and defers colorizing the rest of the document until you scroll through it. How would one implement this? Use NSLayoutManager – via Temporary attributes [which] are used only for on-screen drawing and are not persistent in any way... as the docs say, but that doesn't color the last edited range, until a whitespace character is entered. Custom Helper like UKSyntaxColoredDocument – nice, but language definition is done via property list; how to use additional/existing language definitions? None of the approaches seem r
Tags (comma-separated)
Save Edits
Cancel