Re: NSTextView undo/redo question
Re: NSTextView undo/redo question
- Subject: Re: NSTextView undo/redo question
- From: Brian Webster <email@hidden>
- Date: Sun, 19 Aug 2001 13:43:38 -0500
On Sunday, August 19, 2001, at 11:17 AM, cocoa-dev-
email@hidden wrote:
NSTextView implements a method, setAllowsUndo:, which turns a
text view's
built-in undo/redo behavior on and off.
My question: what is the target of the actions that are registered by
NSTextView's undo/redo routines?
Well, there are probably going to multiple targets, since the
undo support does things such as reselecting previous selections
as well as inserting and deleting text and attributes. So, the
text view, the text storage, and perhaps the layout manager
could all potentially register various undo actions (I doubt the
text container(s) would, though). Not to mention any number of
private objects lurking inside the Cocoa text system. :-|
You might instead try implementing the undoManagerForTextView:
method in your text view's delegate so you can keep a separate
undo manager for the text view. That way, you could just clear
all the actions in the text view's undo manager and keep all the
custom actions in your window's undo manager. You'd just have
to make sure to send an undo message to both managers when the
user selects Undo.
--
Brian Webster
email@hidden
http://www.owlnet.rice.edu/~bwebster