mirror of https://github.com/aseprite/aseprite.git
Replicate same changes from c0dfb832d8 for redo (#3539)
This commit is contained in:
parent
c0dfb832d8
commit
5c4024c44f
|
|
@ -101,9 +101,9 @@ bool DocUndo::canRedo() const
|
|||
void DocUndo::undo()
|
||||
{
|
||||
const size_t oldSize = m_totalUndoSize;
|
||||
const undo::UndoState* state = nextUndo();
|
||||
ASSERT(state);
|
||||
{
|
||||
const undo::UndoState* state = nextUndo();
|
||||
ASSERT(state);
|
||||
const Cmd* cmd = STATE_CMD(state);
|
||||
m_totalUndoSize -= cmd->memSize();
|
||||
m_undoHistory.undo();
|
||||
|
|
@ -120,16 +120,16 @@ void DocUndo::undo()
|
|||
|
||||
void DocUndo::redo()
|
||||
{
|
||||
const undo::UndoState* state = nextRedo();
|
||||
ASSERT(state);
|
||||
const Cmd* cmd = STATE_CMD(state);
|
||||
size_t oldSize = m_totalUndoSize;
|
||||
m_totalUndoSize -= cmd->memSize();
|
||||
const size_t oldSize = m_totalUndoSize;
|
||||
{
|
||||
const undo::UndoState* state = nextRedo();
|
||||
ASSERT(state);
|
||||
const Cmd* cmd = STATE_CMD(state);
|
||||
m_totalUndoSize -= cmd->memSize();
|
||||
m_undoHistory.redo();
|
||||
notify_observers(&DocUndoObserver::onCurrentUndoStateChange, this);
|
||||
m_totalUndoSize += cmd->memSize();
|
||||
}
|
||||
m_totalUndoSize += cmd->memSize();
|
||||
notify_observers(&DocUndoObserver::onCurrentUndoStateChange, this);
|
||||
if (m_totalUndoSize != oldSize)
|
||||
notify_observers(&DocUndoObserver::onTotalUndoSizeChange, this);
|
||||
}
|
||||
|
|
@ -226,6 +226,10 @@ Cmd* DocUndo::lastExecutedCmd() const
|
|||
void DocUndo::moveToState(const undo::UndoState* state)
|
||||
{
|
||||
m_undoHistory.moveTo(state);
|
||||
|
||||
// After onCurrentUndoStateChange don't use the "state" argument, it
|
||||
// might be deleted because some script might have modified the
|
||||
// sprite on its "change" event.
|
||||
notify_observers(&DocUndoObserver::onCurrentUndoStateChange, this);
|
||||
|
||||
// Recalculate the total undo size
|
||||
|
|
|
|||
Loading…
Reference in New Issue