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

LibGUI+TextEditor: Make TextDocument modified state track undo stack

This was quite unreliable before. Changes to the undo stack's modified
state are now reflected in the document's modified state, and the
GUI::TextEditor widget has its undo/redo actions updated automatically.

UndoStack is still a bit hard to understand due to the lazy coalescing
of commands, and that's something we should improve upon (e.g with more
explicit, incremental command merging.) But for now, this is a nice
improvement and undo/redo finally behaves in a way that feels natural.
This commit is contained in:
Andreas Kling 2021-05-08 13:40:33 +02:00
parent ee19f7c0aa
commit 2905e10513
4 changed files with 23 additions and 4 deletions

View file

@ -134,6 +134,7 @@ public:
virtual void redo() { document().redo(); }
Function<void()> on_change;
Function<void(bool modified)> on_modified_change;
Function<void()> on_mousedown;
Function<void()> on_return_pressed;
Function<void()> on_escape_pressed;