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

LibGUI: Support merging of adjacent commands on the UndoStack

When pushing a new command on an undo stack, we will now attempt to
merge it into the stack's current command.

Merging is implemented by overriding the "merge_with(Command const&)"
virtual on GUI::Command. :^)
This commit is contained in:
Andreas Kling 2021-05-08 16:49:36 +02:00
parent 244665d99c
commit ff912946ae
2 changed files with 8 additions and 0 deletions

View file

@ -19,6 +19,8 @@ public:
String action_text() const { return m_action_text; }
virtual bool merge_with(Command const&) { return false; }
protected:
Command() { }
void set_action_text(const String& text) { m_action_text = text; }