diff options
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/EventWriter.hpp | 3 | ||||
-rw-r--r-- | src/server/events/Undo.cpp | 7 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/server/EventWriter.hpp b/src/server/EventWriter.hpp index 7b9b920b..5e05af0c 100644 --- a/src/server/EventWriter.hpp +++ b/src/server/EventWriter.hpp @@ -96,7 +96,8 @@ public: virtual void error(const std::string& msg) {} ///< N/A - void set_event_mode(Event::Mode mode) { _event_mode = mode; } + void set_event_mode(Event::Mode mode) { _event_mode = mode; } + Event::Mode get_event_mode() { return _event_mode; } protected: Engine& _engine; diff --git a/src/server/events/Undo.cpp b/src/server/events/Undo.cpp index 15c18ca2..0510d50f 100644 --- a/src/server/events/Undo.cpp +++ b/src/server/events/Undo.cpp @@ -36,13 +36,14 @@ Undo::Undo(Engine& engine, bool Undo::pre_process() { - UndoStack* stack = _is_redo ? _engine.redo_stack() : _engine.undo_stack(); - Event::Mode mode = _is_redo ? Event::Mode::REDO : Event::Mode::UNDO; + UndoStack* const stack = _is_redo ? _engine.redo_stack() : _engine.undo_stack(); + const Event::Mode mode = _is_redo ? Event::Mode::REDO : Event::Mode::UNDO; if (stack->empty()) { return Event::pre_process_done(Status::NOT_FOUND); } + const Event::Mode orig_mode = _engine.event_writer()->get_event_mode(); _entry = stack->pop(); _engine.event_writer()->set_event_mode(mode); if (_entry.events.size() > 1) { @@ -56,7 +57,7 @@ Undo::pre_process() if (_entry.events.size() > 1) { _engine.interface()->bundle_end(); } - _engine.event_writer()->set_event_mode(mode); + _engine.event_writer()->set_event_mode(orig_mode); return Event::pre_process_done(Status::SUCCESS); } |