Re: Text Array View
Re: Text Array View
- Subject: Re: Text Array View
- From: Rachel Blackman <email@hidden>
- Date: Fri, 16 Sep 2005 17:34:16 -0700
I have a situation wherein I have an array of NSAttributedString
objects. Things can be appended onto the end of this array, and when
it's greater than a certain size, the oldest one falls off.
I just realized that I didn't describe this well. Let me actually
rephrase this better, in hopes someone has already solved the problem.
:)
I have a network stream of characters. It is somewhat like a terminal
stream (inasmuch as I have control sequences I need to deal with for
color and so on), except that I never need to worry about cursor
movement. I will only ever be using one font per display, but do need
other attributes. The user will not be editing the output, but should
be able to select and copy it.
I am guaranteed to get text separated into nice little 'paragraphs' --
these may word-wrap (and need to be indented), but will always
terminate with a newline. Each of these paragraphs should be stored
separately in memory for later reference, since I may need to be able
to filter them and so on.
This seems like an ideal use for an NSTextView, save the problem that
after a certain point, appending anything to the NSTextStorage becomes
ungodly slow. Further, the longer the NSTextStorage content, the more
painful it is on a window resize. Setting an arbitrary limit to the
NSTextStorage content is doable, but not ideal; this view should (in
theory) be able to keep expanding as long as memory is there to handle
it. I do, however, want the /option/ to limit the size of the store.
I've thought of writing a storage class which generates an NSText for
every 'paragraph' in the scrollback and sticks them together into a
view, but I'm not certain that works well for selecting (in terms of
allowing the selection to cross paragraph boundaries, which it must).
I also thought of trying to write an NSTextStorage replacement and
backing my textview with that, but I'm not certain that's the right way
either.
I've been buried in Win32 code at work for the past few months, so
getting back into Cocoa, I'm having to wrap my brain around designing
things the /right/ way, instead of just 'whatever works on Win95,
Win98, WinME, Win2k /and/ WinXP.'
Any input would be most welcomed. :)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden