mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-18 23:42:17 +00:00
LibGUI: Remember modified state on undo/redo actions
This commit is contained in:
parent
67537bfc80
commit
928f16d360
Notes:
sideshowbarker
2024-07-18 18:39:25 +09:00
Author: https://github.com/pakerwreah
Commit: 928f16d360
Pull-request: https://github.com/SerenityOS/serenity/pull/6868
Reviewed-by: https://github.com/awesomekling
5 changed files with 39 additions and 12 deletions
|
@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue