mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-27 03:37:53 +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:
@@ -1638,6 +1638,11 @@ void TextEditor::document_did_update_undo_stack()
|
||||
{
|
||||
m_undo_action->set_enabled(can_undo());
|
||||
m_redo_action->set_enabled(can_redo());
|
||||
|
||||
// FIXME: This is currently firing more often than it should.
|
||||
// Ideally we'd only send this out when the undo stack modified state actually changes.
|
||||
if (on_modified_change)
|
||||
on_modified_change(document().is_modified());
|
||||
}
|
||||
|
||||
void TextEditor::document_did_set_text()
|
||||
|
||||
Reference in New Issue
Block a user