• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: custom text data and undo
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >custom text data and undo (From: Jerry <email@hidden>)

  • Prev by Date: Re: How to get NSText for custom NSCell in NSTable?
  • Next by Date: Do bindings "pay attention" to visibility of control?
  • Previous by thread: custom text data and undo
  • Next by thread: Optimizing NSTreeController setContent: calls
  • Index(es):
    • Date
    • Thread