mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 17:49:40 +00:00
LibGUI: Reset TextEditor modified state on sucessful write_to_file
Avoids missing reset of the state if saving is done in multiple places.
This commit is contained in:
parent
3cafdca868
commit
2b24fbdaaa
Notes:
sideshowbarker
2024-07-18 17:55:14 +09:00
Author: https://github.com/faxe1008 🔰
Commit: 2b24fbdaaa
Pull-request: https://github.com/SerenityOS/serenity/pull/7193
Reviewed-by: https://github.com/linusg
2 changed files with 1 additions and 4 deletions
|
@ -302,8 +302,6 @@ MainWidget::MainWidget()
|
||||||
GUI::MessageBox::show(window(), "Unable to save file.\n", "Error", GUI::MessageBox::Type::Error);
|
GUI::MessageBox::show(window(), "Unable to save file.\n", "Error", GUI::MessageBox::Type::Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
editor().document().set_unmodified();
|
|
||||||
// FIXME: It would be cool if this would propagate from GUI::TextDocument somehow.
|
// FIXME: It would be cool if this would propagate from GUI::TextDocument somehow.
|
||||||
window()->set_modified(false);
|
window()->set_modified(false);
|
||||||
|
|
||||||
|
@ -316,7 +314,6 @@ MainWidget::MainWidget()
|
||||||
if (!m_editor->write_to_file(m_path)) {
|
if (!m_editor->write_to_file(m_path)) {
|
||||||
GUI::MessageBox::show(window(), "Unable to save file.\n", "Error", GUI::MessageBox::Type::Error);
|
GUI::MessageBox::show(window(), "Unable to save file.\n", "Error", GUI::MessageBox::Type::Error);
|
||||||
} else {
|
} else {
|
||||||
editor().document().set_unmodified();
|
|
||||||
// FIXME: It would be cool if this would propagate from GUI::TextDocument somehow.
|
// FIXME: It would be cool if this would propagate from GUI::TextDocument somehow.
|
||||||
window()->set_modified(false);
|
window()->set_modified(false);
|
||||||
|
|
||||||
|
|
|
@ -1190,7 +1190,7 @@ bool TextEditor::write_to_file(const String& path)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
document().set_unmodified();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue