Re: NSTextView and Syntax Highlighting

2014-12-20 Thread Charles Jenkins
Martin, Ecir, and Quincey: Thank you all! All three answers turned out to be helpful. (Quincey, you led me to learn about how to get attributed substrings, should I ever need to do it.) Martin, your chief difference from my code seems be calling the layout manager’s ensureGlyphsForCharacterRa

Re: NSTextView and Syntax Highlighting

2014-12-19 Thread Martin Hewitson
I’m using temporary attributes for TeXnicle (LaTeX editor), but as others have said, it doesn’t work if you need bold etc. Anyway, you can see the source at github: https://github.com/martinhewitson/TeXnicle You need to look in TeXnicle/TeXnicle/TeXEditor/TextView/TeXColoringEngine.m Origina

Re: NSTextView and Syntax Highlighting

2014-12-19 Thread ecir hana
On Fri, Dec 19, 2014 at 6:58 PM, Quincey Morris < quinceymor...@rivergatesoftware.com> wrote: > On Dec 19, 2014, at 05:36 , Charles Jenkins wrote: > > > > Could it be that even though the layout manager's temporary attributes > are designed for purposes like syntax highlighting, folks don't actua

Re: NSTextView and Syntax Highlighting

2014-12-19 Thread Quincey Morris
On Dec 19, 2014, at 05:36 , Charles Jenkins wrote: > > Could it be that even though the layout manager's temporary attributes are > designed for purposes like syntax highlighting, folks don't actually use them > because they don't work right during edits? I tried to use them once for underli

Re: NSTextView and Syntax Highlighting

2014-12-19 Thread Charles Jenkins
So I used DuckDuckGo to find "NSText syntax highlight," which led me to Uli Kusterer's site where there an example syntax highlighting document project. If I'm reading the code right, it appears Uli builds a new attributed string with text colors and uses that to replace the original edited ra