mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-01 12:07:14 +02: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:
Notes:
sideshowbarker
2024-07-18 18:31:12 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/2905e105138
@@ -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