Re: Adding actions to undo manager
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