Undoing "Make Small Caps" changes the selection

Steps to reproduce:

  • select a complete sentence (starting with a capital, ending with a full stop)
  • select Edit/Transformations/Make Small Caps
  • press Cmd+Z

Result:
The selection is changed to not include the first and last character.

Expected:
The selection should stay the same.

Use case: I might make up my mind about small caps and want to use italics instead. “Undo” followed by “Cmd+i” will miss parts of the original selection.

I can reproduce this too.

This is not a bug. Or rather, not a Scrivener one. Scrivener just says: “record that I’m adding this text, so that you can undo it”. Then macOS handles the undo. Because certain actions do more than one thing, undo is sometimes a little unreliable with its selection afterwards.