StateTransFunctions pass on only distinct events

We do not want to keep Undo/Redo track of the same states. We
do not want to display stuff in the UI that has not changed. We
want to process only distinct values.

Some tests failed after this change (actually almost all of them)
so they had to be adjusted.