Re: custom text data and undo
Re: custom text data and undo
- Subject: Re: custom text data and undo
- From: Douglas Davidson <email@hidden>
- Date: Mon, 5 Dec 2005 10:52:31 -0800
On Dec 5, 2005, at 5:05 AM, Jerry wrote:
I have written a specialized word processor that requires extra
data to be associated with the text. Using text attributes to
represent the data doesn't work out because the range of the
associated data can be zero in length (for instance, when no text
has been typed yet), and using text attachments doesn't always work
because the range of the associated data can be greater than one.
The standard way to handle this is to use text attributes for cases
in which the data is associated with a range of the text, and to use
the same attributes in the textview's typingAttributes for the case
in which it is not. If the attributes are required to be stored with
the text, even if they do not apply to any range of the text, then
one could attach an extra dictionary to the text storage. In order
to be handled by the text system's undo mechanism, however,
attributes need to be stored as text attributes on some range of the
text storage, at least at the point at which undo registration is
actually done (in NSTextView's
shouldChangeTextInRanges:replacementStrings:, or
shouldChangeTextInRange:replacementString: pre-Tiger).
Douglas Davidson
_______________________________________________
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