summaryrefslogtreecommitdiff
path: root/src/texteditor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/texteditor.cpp')
-rw-r--r--src/texteditor.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/texteditor.cpp b/src/texteditor.cpp
index 78ce1610..99490b22 100644
--- a/src/texteditor.cpp
+++ b/src/texteditor.cpp
@@ -60,9 +60,19 @@ void TextEditor::setDefaultStyle()
bool TextEditor::load(const QString& filename)
{
m_filename = filename;
- setPlainText(MOBase::readFileText(filename, &m_encoding));
+ clear();
+
+ const QString s = MOBase::readFileText(filename, &m_encoding);
+
+ setPlainText(s);
document()->setModified(false);
+ if (s.isEmpty()) {
+ // the modificationChanged even is not fired by the setModified() call
+ // above when the text being set is empty
+ onModified(false);
+ }
+
return true;
}