On Dec 24, 2017, at 16:36 , Alan Snyder <applemail832...@cbfiddle.com> wrote:
> 
> But suppose the document is autosaved between the cut and paste, and the app 
> or system crashes before the next autosave.
> 
> Would the content then be lost, and would the user even know?

1. Without autosave, the history of your document as represented on disk is 
logically like this:

        … Save … Save … Save

In the case of a crash, you can go back to the last save, which may or may not 
be recent. In your scenario, you might not lose data due to a cut that’s not 
pasted, but (as we all know from personal experience in the bad old days) 
you’ll probably lose some other important edit(s) since the last explicit save.

With autosave, the history starts to look like this:

        … Save … Autosave … Autosave … Save … Autosave … Autosave … Autosave

In a sense, you’re no worse off after a crash, because you can hop back to the 
last save. This isn’t *quite* true, because with autosave you might 
explicitly-save less often than in the old days, but whether it’s practically 
better or worse depends on what changes you make and when.

2. Autosave tries not to expose users to the kind of data loss you describe. 
Changing the NSDocument object will (in general) reset the autosave timer, so 
it’s extremely unlikely your document will get autosaved right after the cut. 
(The timer is about 20 seconds, so if you wait that long before pasting, an 
autosave can intervene.)

3. Turning on autosave-in-place also turns on document versioning. A new 
version is create on every explicit save, and at *some* autosaves (though the 
documentation says not all). That means you have a reasonable chance to browse 
the document version history to look for the data you cut (and lost in a crash).

4. If you’re really worried about it, there might be something you can do with 
persisting undo information (at least back to, say, the last explicit save) in 
your document. It’s probably hard to design your app so that undo actions are 
serializable, but probably not impossible.

Overall, though, I think the answer is that autosave-in-place is a usability 
win in general, and protects the data more often that loses it.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to