1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:57:45 +00:00

LibGUI: Fix undo stack

This would undo all commands at once instead of one at a time.
This commit is contained in:
BenJilks 2020-11-13 12:57:33 +00:00 committed by Andreas Kling
parent 76aeb7cad8
commit 7707ebcd63
2 changed files with 36 additions and 53 deletions

View file

@ -39,7 +39,7 @@ public:
void push(NonnullOwnPtr<Command>&&);
bool can_undo() const { return m_stack_index < m_stack.size() && !m_stack.is_empty(); }
bool can_redo() const { return m_stack_index > 0 && m_stack[m_stack_index - 1].m_undo_vector.size() > 0 && !m_stack.is_empty(); }
bool can_redo() const { return m_stack_index > 0 && !m_stack.is_empty(); }
void undo();
void redo();
@ -53,7 +53,6 @@ private:
NonnullOwnPtrVector<UndoCommandsContainer> m_stack;
size_t m_stack_index { 0 };
size_t m_last_updated_undo_vector_size { 0 };
};
}