Re: undo text in an NSTextView
Re: undo text in an NSTextView
- Subject: Re: undo text in an NSTextView
- From: Bill Cheeseman <email@hidden>
- Date: Fri, 06 Sep 2002 09:29:35 -0400
on 02-09-06 8:13 AM, nicky at email@hidden wrote:
>
What we want is this:
>
- set the textView in edit mode
>
- type some text :"hello"
>
- go out of edit mode
>
- return to edit mode
>
- type again :"all"
>
- go out of edit mode
>
- "undo typing" (should remove "all") (in the sketch example now "hello
>
all" is removed)
>
- "undo typing" (should remove "hello")
I guess what you want is considered incorrect behavior. You get the behavior
you want only if, when you go out of edit mode after typing "hello," you
type something in some other text view or click a checkbox -- anything that
adds a new undo group to the undo stack. But if you "go out of edit mode"
and don't do anything that adds a new group to the undo stack, then when you
"return to edit mode" the undo manager thinks your original undo group is
still open.
To get the behavior you want, I believe you would either have to roll your
own text system undo code -- a major undertaking -- or implement some
delegate method that knows when focus has left the text view and, in the
delegate method, tell the undo manager to close the pending undo group (if
there is one). I'm not sure how you would do that, but it might become clear
from looking at the NSUndoManager class reference document. I imagine
endUndoGrouping is the method to play with.
--
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.