mirror of
https://github.com/RGBCube/serenity
synced 2025-07-08 23:07:35 +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:
parent
ee19f7c0aa
commit
2905e10513
4 changed files with 23 additions and 4 deletions
|
@ -59,7 +59,10 @@ MainWidget::MainWidget()
|
|||
|
||||
m_editor->on_change = [this] {
|
||||
update_preview();
|
||||
window()->set_modified(editor().document().is_modified());
|
||||
};
|
||||
|
||||
m_editor->on_modified_change = [this](bool modified) {
|
||||
window()->set_modified(modified);
|
||||
};
|
||||
|
||||
m_page_view = *find_descendant_of_type_named<Web::OutOfProcessWebView>("webview");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue