Hi Kyle, I already have the model objects being backed by individual NSTextContainers which then adopt the text view when they need to (using setTextView:). I was just wondering if there are any recommendations how to conceptually handle code folding, especially as I have line numbering. So, should I just add some functionality (markers and mouse handling) to my NSRulerView subclass, and then detect from the text where to draw disclosure triangles, and somehow fix-up the line numbers? Then what to do with the text that is collapsed? One idea I had would be to put the text that is collapsed in to a text attachment and replace the text then by the attachment with an appropriate icon or indicator.
Does that all seem like a sensible approach? Cheers, Martin On Mar 24, 2010, at 5:58 PM, Kyle Sluder wrote: > On Mar 24, 2010, at 9:46 AM, Martin Hewitson <martin.hewit...@aei.mpg.de> > wrote: > >> So, does anyone have any suggestions how one might implement such a feature? >> This is for a LaTeX editor so I'm interested in folding blocks of code >> between, for example, \begin{} \end{} tags, collapsing \section, >> \subsection, etc. > > There isn't support for anything like this in NSTextView; you're going to > have to mutate the text storage yourself. The upshot of this is that you can > no longer keep your text buffer in an NSTextStorage and build your text > system around it; you will now need to synchronize the edits made to your > text view's text storage with whatever backing store you wind up using for > your document (perhaps another NSTextStorage, or a different data structure > of your choosing). > > --Kyle Sluder ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Martin Hewitson Albert-Einstein-Institut Max-Planck-Institut fuer Gravitationsphysik und Universitaet Hannover Callinstr. 38, 30167 Hannover, Germany Tel: +49-511-762-17121, Fax: +49-511-762-5861 E-Mail: martin.hewit...@aei.mpg.de WWW: http://www.aei.mpg.de/~hewitson ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com