1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:37:34 +00:00

LibGUI: Remember modified state on undo/redo actions

This commit is contained in:
Carlos César Neves Enumo 2021-05-05 14:09:43 -03:00 committed by Andreas Kling
parent 67537bfc80
commit 928f16d360
5 changed files with 39 additions and 12 deletions

View file

@ -19,13 +19,16 @@ 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.is_empty(); }
bool can_redo() const { return m_stack_index > 0 && !m_stack.is_empty() && m_stack[m_stack_index - 1].m_undo_vector.size() > 0; }
void undo();
void redo();
void finalize_current_combo();
void set_current_unmodified();
bool is_current_modified() const;
void clear();
private:
@ -35,6 +38,7 @@ private:
NonnullOwnPtrVector<UndoCommandsContainer> m_stack;
size_t m_stack_index { 0 };
Optional<size_t> m_clean_index;
};
}