Remove last transaction from UndoManager history

If I had devised such a solution I would have told you.

By the way, the ability to call Transaction.clear seems like a mis-implementation “feature” – one shouldn’t be able to modify transactions in that circumstance. But maybe we are being over-restrictive on the (in)ability for programmers to modify the undo history. It’s just that with these restrictions we basically never get any problems relating to undo/redo, a pleasant situation that is rarer than you might expect.

Maybe you could override UndoManager.undo and redo to skip over empty Transactions. (Sorry, I can’t try that for you at the moment.)