Re: Syntax-coloring NSTextView
Re: Syntax-coloring NSTextView
- Subject: Re: Syntax-coloring NSTextView
- From: Douglas Davidson <email@hidden>
- Date: Wed, 30 Oct 2002 12:36:00 -0800
On Tuesday, October 29, 2002, at 08:13 PM, Ryan Z. Hale wrote:
I've picked through some open source apps (the ones that wrap around
TeX or something) and attempted to figure out syntax coloring. I'm
writing an HTML editor and would like different things to be colored,
i.e different colors for different tags. I have an NSTextView (created
programatically as HTTextView, borrowed from Stepwise) that the code
is typed in.
You might check the archives of this and the omni mailing lists. The
last time this question was asked, I suggested the use of temporary
attributes for syntax coloring. Temporary attributes are stored in the
layout manager, hence do not affect or dirty the underlying text
storage. Only certain attributes are usable as temporary attributes,
primarily those that do not affect layout, such as colors. You can
listen for changes to the text at the view level, via NSTextView
delegate methods and notifications, at the model level, via
NSTextStorage, or potentially at the controller level, via
NSLayoutManager.
Douglas Davidson
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.