Fix for issue #140 (Ctrl-Z in editor)

Undo buffer was filled inconsistently with forward changes.
Merge pull request #141 from helgp/master

Fix for issue #140 (Ctrl-Z in editor)