• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSUndo & TextStorage limitation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSUndo & TextStorage limitation


  • Subject: NSUndo & TextStorage limitation
  • From: Stephane <email@hidden>
  • Date: Wed, 11 Oct 2006 13:00:48 +0200

There seems to be a limitation or a bug in the NSUndo TextStorage.

Let's imagine I have 2 text fields A and B.

+----+ +----+
| A  | | B  |
+----+ +----+

When I type text in A, - (void)controlTextDidChange:(NSNotification *) aNotification is called for by A's delegate. The implementation may decide to make B the first responder if A contains 3 letters.

Here is the problem with the NSUndo (Stack, Manager, whatever):

1. I type 3 letters in A
2. the first responder is set to be B
3. I select all the letters in A
4. I delete them with the delete key
5. I use the Undo Typing menu item

Result:

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.

Any second thought?

_______________________________________________
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


  • Follow-Ups:
    • Re: NSUndo & TextStorage limitation
      • From: Keary Suska <email@hidden>
  • Prev by Date: Re: Temporary files
  • Next by Date: Core Data Applications
  • Previous by thread: NSSearchField and Core Data Problem
  • Next by thread: Re: NSUndo & TextStorage limitation
  • Index(es):
    • Date
    • Thread