• 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: Adding actions to undo manager
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding actions to undo manager


  • Subject: Re: Adding actions to undo manager
  • From: Kyle Sluder <email@hidden>
  • Date: Mon, 15 Jun 2009 18:52:38 -0700

I don't know where your -doCustomThing: method lives, what it does, or
how it's invoked.  All I know is that it manipulated an NSTextStorage.

In NSTextView land, the topmost methods that manipulate text storages
are things like -cut: or -insertText:.  They know what undo actions to
register with the NSUndoManager.  Likewise, your code needs to
register the appropriate counter-method with the undo manager.  There
should be no assuming going on.  The NSTextStorage is precisely what
it claims to be; it stores text.  You've built a layer on top of
NSTextStorage that you need to add undo support to; only this code can
know what to register with the undo manager in order to counteract its
actions.

IOW, don't listen for changes to the text storage and register undo
actions based on your best guess.  Rather, register your undo actions
in the higher-level methods, alongside your modifications to the text
storage.

--Kyle Sluder
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

References: 
 >Adding actions to undo manager (From: Ryan Joseph <email@hidden>)
 >Re: Adding actions to undo manager (From: Kyle Sluder <email@hidden>)
 >Re: Adding actions to undo manager (From: Ryan Joseph <email@hidden>)
 >Re: Adding actions to undo manager (From: "I. Savant" <email@hidden>)
 >Re: Adding actions to undo manager (From: Ryan Joseph <email@hidden>)
 >Re: Adding actions to undo manager (From: Kyle Sluder <email@hidden>)
 >Re: Adding actions to undo manager (From: Ryan Joseph <email@hidden>)

  • Prev by Date: Re: Adding actions to undo manager
  • Next by Date: [Q] NSPopupButton: always show entire menu
  • Previous by thread: Re: Adding actions to undo manager
  • Next by thread: Core Data, to-many relationships, and object graph consistency
  • Index(es):
    • Date
    • Thread