FXMisc / UndoFX

Undo manager for JavaFX
BSD 2-Clause "Simplified" License
98 stars 17 forks source link

[Question] Unexpected change received? #7

Closed benedictleejh closed 9 years ago

benedictleejh commented 9 years ago

This is probably me not understanding the changes in 1.2, but when I undo an action, then redo it, and then try to take a new action, the undo manager crashes with an Unexpected change received.

Am I supposed to send redone changes to the change stream as well?

TomasMikula commented 9 years ago

Yes. Doesn't that make the code easier, not having to care whether to push a change to the UndoManager or not? Just uniformly push all the changes.

Btw, that was the assumption in pre-1.2 too, that UndoManager would receive all the changes. In pre-1.2, it just ignored any changes received while doing undo/redo. In 1.2, it checks whether the incoming change is exactly the same (as per equals) as the one being re-done.

benedictleejh commented 9 years ago

That does make it simpler. I was manually handling this before, but this is nice since I don't have to think about it anymore.

I do, however, suggest noting it somewhere, because I suspect when people think about undo, one of the first questions that come up is how do I not cause an infinite loop of undone changes causing new undoable changes (at least, it was what I was thinking about).

I'll close the issue too, since the question's been answered.