• 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
NSUndoManager grouping somewhat broken?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSUndoManager grouping somewhat broken?


  • Subject: NSUndoManager grouping somewhat broken?
  • From: Graham Cox <email@hidden>
  • Date: Tue, 8 Apr 2008 16:14:53 +1000

I am getting funny results using grouping in NSUndoManager.

If I begin a group on mouse down, and end the group on mouse up, even if I do nothing in between, it seems to record an undo task, with the plain name "Undo" in the menu, dirtying the document. The "task" is null - it doesn't actually undo anything.

When I go to close a document with its undo manager in this state, it hangs indefinitely before putting up the save changes dialog. (I get nothing i the log or GDB to indicate why it's hanging, but the dialog doesn't appear).

Surely it's incorrect for NSUndoManager to treat an empty group as a real undo task?

Working around this is proving to be extremely troublesome - for example I've tried subclassing NSUndoManager and overriding beginUndoGrouping, and for grouping beyond level zero, I defer the group opening until a task is actually received. Likewise, endUndoGrouping doesn't close the group if it was never really opened. Problem is, I can't get this to work - the docs are unclear about whether these exact methods are called by the standard event/run loop grouping (they appear not to be), and frankly the workings of undo groups seem to be shrouded in mystery.

The other workaround is to try and predict which operations between mouse down and mouse up really will make an undo task, and try and open a group "just in time" to receive them. Naturally given the hundreds of possible tasks that the mouse can create, this is a really difficult approach in and of itself.

Can someone confirm that undo groups are broken in this way, or if they are not broken, explain what the hell the logic is here?

Better still, has anyone written an NSUndoManager subclass that fixes this?


------ S.O.S. _______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSUndoManager grouping somewhat broken?
      • From: Quincey Morris <email@hidden>
    • Re: NSUndoManager grouping somewhat broken?
      • From: Florent Pillet <email@hidden>
  • Prev by Date: Re: fileHFSCreatorCode & fileAttributesAtPath:traverseLink on app bundles
  • Next by Date: alBufferData, void * data
  • Previous by thread: Re: fileHFSCreatorCode & fileAttributesAtPath:traverseLink on app bundles
  • Next by thread: Re: NSUndoManager grouping somewhat broken?
  • Index(es):
    • Date
    • Thread