[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_stack.emplace_back(cmd);
|
||||||
++m_stackIdx;
|
++m_stackIdx;
|
||||||
|
cmd->redo();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UndoStack::redo() noexcept {
|
void UndoStack::redo() noexcept {
|
||||||
|
if (m_stackIdx < m_stack.size()) {
|
||||||
m_stack[m_stackIdx++]->redo();
|
m_stack[m_stackIdx++]->redo();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UndoStack::undo() noexcept {
|
void UndoStack::undo() noexcept {
|
||||||
|
if (m_stackIdx < ox::MaxValue<decltype(m_stackIdx)>) {
|
||||||
m_stack[m_stackIdx--]->undo();
|
m_stack[m_stackIdx--]->undo();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user