Preserves undo status if using the internal editor together with 'autoreload and compile'
Merge pull request #788 from OskarLinde/autoreload_undo_fix

auto-reload & compile with internal editor preserve undo status