Adding to NSTextView's current undo group?
Adding to NSTextView's current undo group?
- Subject: Adding to NSTextView's current undo group?
- From: Keith Blount <email@hidden>
- Date: Sun, 3 Apr 2005 04:43:03 -0700 (PDT)
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
Hello,
Does anybody know if there is a way to add undo
invocations to NSTextView's undo stack without
starting a new undo group?
I have a custom text view that holds an array of
notes. In my override of -didChangeText, I update the
information in this array, as the notes keep track of
which characters in the text view they are attached
to. I am using Key-Value Observing and calling undo
whenever a change is made to ensure that these changes
are undoable. So my textDidChange method looks
something like this:
- (void)textDidChange
{
NSUndoManager *undo = [self undoManager];
// Only make update info if we are not in an undo
if ( (![undo isUndoing]) && (![undoIsRedoing]) )
[self makeChangesToNoteData];
[super didChangeText];
}
The problem is that because makeChangesToNoteData sets
up undo, this automatically starts a new undo group
rather than being added to the current one, because
NSTextView notes that it is not a typing change. The
result of this is that when the user hits undo after a
typing change, the typing will be undone
letter-by-letter - ouch.
So is there any way to add my undo methods to the
current undo group and force the text view not to
start a new one?
Many thanks in advance,
Keith
__________________________________
Yahoo! Messenger
Show us what our next emoticon should look like. Join the fun.
http://www.advision.webevents.yahoo.com/emoticontest
_______________________________________________
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