diff --git a/Makefile b/Makefile index a9f6c13..775afdb 100644 --- a/Makefile +++ b/Makefile @@ -29,6 +29,7 @@ COMMON = \ profiling.cc \ shaders.cc \ odbg.cc \ + undo.cc \ \ sync.cc \ syncoverrides.cc \ @@ -45,7 +46,6 @@ DEMO = \ main.cc \ syncedit.cc \ syncview.cc \ - undo.cc \ # END DEMO PARSERCHECK = \ diff --git a/undo.cc b/undo.cc index db449f9..58e6c02 100644 --- a/undo.cc +++ b/undo.cc @@ -10,6 +10,13 @@ A_UndoAction::~A_UndoAction( ) /*= T_UndoManager ==============================================================*/ +T_UndoManager::T_UndoManager( ) noexcept +{ + while ( actions_.size( ) < MaxUndo ) { + actions_.addNew( ); + } +} + void T_UndoManager::undo( ) noexcept { if ( pos_ > 0 ) { @@ -21,8 +28,8 @@ void T_UndoManager::undo( ) noexcept void T_UndoManager::redo( ) noexcept { if ( pos_ < count_ ) { - pos_ ++; actions_[ ( start_ + pos_ ) % MaxUndo ]->redo( ); + pos_ ++; } } diff --git a/undo.hh b/undo.hh index c0462ae..abca968 100644 --- a/undo.hh +++ b/undo.hh @@ -27,7 +27,7 @@ class T_UndoManager uint32_t pos_{ 0 }; public: - T_UndoManager( ) noexcept = default; + T_UndoManager( ) noexcept; DEF_MOVE( T_UndoManager ); NO_COPY( T_UndoManager );