Undo within a modal dialog

We're having a debate about how "Undo" should operate, specifically within a modal dialog box (on a desktop platform).

What I see generally in applications is that each individual control (text box generally) has its own "undo". So if you type a change into a text box, then press Ctrl-Z it undoes the change to that text box.

What I've never seen is an Undo chain that spans multiple entry fields in the dialog. So to explain:

  • User makes changes to field A
  • User makes a change to a different field, B
  • User presses Ctrl-Z. Change to field B is undone.
  • User presses Ctrl-Z again. Focus changes to field A and change to that is undone.

This might be what you expect within an "editor" (the "project properties" editor of a C# project within Visual Studio does this for example), something with a "save" model, but doesn't feel like what I'd expect within a modal dialog with an "ok"/"cancel" model. However I can't find any UX guidelines that back my feeling up (or indeed contradict it).

It perhaps depends on how complex the dialog is. Clearly for a simple dialog, just cancelling the dialog gets you out of trouble, or using a "reset" button for example, something along those lines.

Is there a good principal to apply here, a "normal" behaviour? Are there any documented UX design principles I can reference that might cover this?

Thanks.