Undo grouping question
Undo grouping question
- Subject: Undo grouping question
- From: Bill Cheeseman <email@hidden>
- Date: Wed, 13 Mar 2002 16:51:17 -0500
I'm trying to implement live undo and redo while editing a text field that
has an attached on-the-fly formatter. I create a separate text view to serve
as the text field's field editor and turn on its undo support. Everything
works fine except for this:
The undo manager opens a new undo group every time my formatter inserts a
delimiter character programmatically while I'm typing (e.g., the formatter
inserts a comma after every third digit I type). After that, if I invoke
Undo and Redo a few times, the undo manager gets out of sync and I
eventually crash with a range error.
I can't find an easy way to prevent the opening of a new undo group. It
looks like I might have to write a subclass of NSTextView and make it the
field editor for this text field, so that I can override a method to adjust
the range and replacement string that the text system expects from the
formatter.
It would help if I understood what is triggering the opening of a new undo
group, so here's the QUESTION: How does NSTextView decide when it needs to
open a new undo group?
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com
The AppleScript Sourcebook -
http://www.AppleScriptSourcebook.com
Vermont Recipes -
http://www.stepwise.com/Articles/VermontRecipes
Croquet Club of Vermont -
http://members.valley.net/croquetvermont
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.