[nostalgia/studio] Make UndoCommand::redo execute as soon as pushed
This commit is contained in:
parent
3785d192f9
commit
4f69f027ef
@ -12,14 +12,19 @@ void UndoStack::push(UndoCommand *cmd) noexcept {
|
||||
}
|
||||
m_stack.emplace_back(cmd);
|
||||
++m_stackIdx;
|
||||
cmd->redo();
|
||||
}
|
||||
|
||||
void UndoStack::redo() noexcept {
|
||||
m_stack[m_stackIdx++]->redo();
|
||||
if (m_stackIdx < m_stack.size()) {
|
||||
m_stack[m_stackIdx++]->redo();
|
||||
}
|
||||
}
|
||||
|
||||
void UndoStack::undo() noexcept {
|
||||
m_stack[m_stackIdx--]->undo();
|
||||
if (m_stackIdx < ox::MaxValue<decltype(m_stackIdx)>) {
|
||||
m_stack[m_stackIdx--]->undo();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user