mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:08:10 +00:00
HackStudio: Reuse TextDocument::is_modified()
Previously, the modification tag in the editor file label was unset only after a file was saved. This commit will also unset the tag if you undo the stack (for example by hitting Ctrl+Z) to the last saved state.
This commit is contained in:
parent
2c22ff94b4
commit
cf71805aa8
3 changed files with 7 additions and 19 deletions
|
@ -1253,7 +1253,7 @@ HackStudioWidget::ContinueDecision HackStudioWidget::warn_unsaved_changes(const
|
|||
|
||||
if (result == GUI::MessageBox::ExecYes) {
|
||||
for (auto& editor_wrapper : m_all_editor_wrappers) {
|
||||
if (editor_wrapper.document_dirty()) {
|
||||
if (editor_wrapper.editor().document().is_modified()) {
|
||||
editor_wrapper.save();
|
||||
}
|
||||
}
|
||||
|
@ -1264,12 +1264,9 @@ HackStudioWidget::ContinueDecision HackStudioWidget::warn_unsaved_changes(const
|
|||
|
||||
bool HackStudioWidget::any_document_is_dirty() const
|
||||
{
|
||||
for (auto& editor_wrapper : m_all_editor_wrappers) {
|
||||
if (editor_wrapper.document_dirty()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return any_of(m_all_editor_wrappers, [](auto& editor_wrapper) {
|
||||
return editor_wrapper.editor().document().is_modified();
|
||||
});
|
||||
}
|
||||
|
||||
void HackStudioWidget::update_gml_preview()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue