summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfaxe1008 <fabianblatz@gmail.com>2021-05-16 21:30:46 +0200
committerLinus Groh <mail@linusgroh.de>2021-05-17 21:04:54 +0100
commit2b24fbdaaa12855f89dcf6adaa93dda7b4c48630 (patch)
tree4c74ec72e57c21db750cccf16414f7ac568a2530
parent3cafdca86885bd86a7875a60a6d97a9ed3b60d32 (diff)
downloadserenity-2b24fbdaaa12855f89dcf6adaa93dda7b4c48630.zip
LibGUI: Reset TextEditor modified state on sucessful write_to_file
Avoids missing reset of the state if saving is done in multiple places.
-rw-r--r--Userland/Applications/TextEditor/MainWidget.cpp3
-rw-r--r--Userland/Libraries/LibGUI/TextEditor.cpp2
2 files changed, 1 insertions, 4 deletions
diff --git a/Userland/Applications/TextEditor/MainWidget.cpp b/Userland/Applications/TextEditor/MainWidget.cpp
index 94ee755bbe..44949060ce 100644
--- a/Userland/Applications/TextEditor/MainWidget.cpp
+++ b/Userland/Applications/TextEditor/MainWidget.cpp
@@ -302,8 +302,6 @@ MainWidget::MainWidget()
GUI::MessageBox::show(window(), "Unable to save file.\n", "Error", GUI::MessageBox::Type::Error);
return;
}
-
- editor().document().set_unmodified();
// FIXME: It would be cool if this would propagate from GUI::TextDocument somehow.
window()->set_modified(false);
@@ -316,7 +314,6 @@ MainWidget::MainWidget()
if (!m_editor->write_to_file(m_path)) {
GUI::MessageBox::show(window(), "Unable to save file.\n", "Error", GUI::MessageBox::Type::Error);
} else {
- editor().document().set_unmodified();
// FIXME: It would be cool if this would propagate from GUI::TextDocument somehow.
window()->set_modified(false);
diff --git a/Userland/Libraries/LibGUI/TextEditor.cpp b/Userland/Libraries/LibGUI/TextEditor.cpp
index e1061a4aa8..27de6f61d2 100644
--- a/Userland/Libraries/LibGUI/TextEditor.cpp
+++ b/Userland/Libraries/LibGUI/TextEditor.cpp
@@ -1190,7 +1190,7 @@ bool TextEditor::write_to_file(const String& path)
return false;
}
}
-
+ document().set_unmodified();
return true;
}