Re: NSUndo & TextStorage limitation
Re: NSUndo & TextStorage limitation
- Subject: Re: NSUndo & TextStorage limitation
- From: Keary Suska <email@hidden>
- Date: Wed, 11 Oct 2006 11:06:43 -0600
- Thread-topic: NSUndo & TextStorage limitation
on 10/11/06 5:00 AM, email@hidden purportedly said:
> A is filled back with the 3 original letters
> B is set as the first responder
>
> But an exception is raised claiming that [NSBigMutableString
> substring:fromIndex:] has some values out of range.
>
> This problem is caused by the fact that the first responder is no
> more the "original" first responder after controlTextDidChange: was
> called.
>
> "Of course", this can be solved by calling makeFirstResponder: with a
> delay (performSelector:withObject:afterDelay:).
>
> But this looks like to be a limitation (or a bug) in the NSUndo API
> or the TextStorage implementation.
I have come across similar issues, and I would say that it's not the fault
of NSUndoManager or the storage class (which I think is part of the NSString
class cluster), but the field editor, who is leaving the undo stack in a bad
state.
In my understanding, once the field editor has committed (or discarded)
editing the undo stack is cleared. It appears that -makeFirstResponder is
not "committing" before changing. This may have to do with there being only
one field editor instance that prefers changes to occur through the GUI,
rather than programmatically. Have you tried calling -commitEditing on the
field editor before -makeFirstResponder?
IMHO, this is more of an issue of Cocoa's notorious
if-you-use-this-method-there-is-other-stuff-you-need-to-do-but-it's-not-docu
mented-clearly issue.
Best,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
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