| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
So a couple possible ways to keep the text system from doing this is to:
1) Add your own undo invocation to the stack when you save (which doesn't need to do anything).
Then when you next make a typing change, the text system looks at the top of the stack, sees it isn't a typing change, and makes a new undo group. You could also use this "on save" undo invocation call something that brings up a "you are about to go back before this file was saved" warning dialog.
2) You could also do something when you save to simply convince the text view that it should make a new typing "group". Probably the easiest way is to simply change the selection (to anything different), then change it back. NSTextView starts a new typing group if you change the selection between typing characters.
Yes, that would be nice.
I guess I would approach this by using your own controller object with -insertMacro: and -deleteMacro: methods, and have them register each other to undo each other's actions. You can set the selection range appropriately in each instead of depending upon NSTextView's undo management.
Hope this helps
| References: | |
| >Re: understanding NSTextView undo? (From: Greg Titus <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.