mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:18:11 +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
|
@ -42,13 +42,8 @@ EditorWrapper::EditorWrapper()
|
|||
open_file(path);
|
||||
};
|
||||
|
||||
m_editor->on_change = [this] {
|
||||
if (this->on_change)
|
||||
this->on_change();
|
||||
bool was_dirty = m_document_dirty;
|
||||
m_document_dirty = true;
|
||||
if (!was_dirty)
|
||||
update_title();
|
||||
m_editor->on_modified_change = [this](bool) {
|
||||
update_title();
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -91,8 +86,6 @@ void EditorWrapper::set_filename(const String& filename)
|
|||
void EditorWrapper::save()
|
||||
{
|
||||
editor().write_to_file(filename());
|
||||
m_document_dirty = false;
|
||||
update_title();
|
||||
update_diff();
|
||||
editor().update();
|
||||
}
|
||||
|
@ -128,7 +121,7 @@ void EditorWrapper::update_title()
|
|||
else
|
||||
title.append(m_filename);
|
||||
|
||||
if (m_document_dirty)
|
||||
if (editor().document().is_modified())
|
||||
title.append(" (*)");
|
||||
m_filename_label->set_text(title.to_string());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue