diff options
author | Carlos César Neves Enumo <paker_wreah@hotmail.com> | 2021-05-05 14:09:43 -0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-05-06 08:40:26 +0200 |
commit | 928f16d3608138480def073188210e7c3b6790a2 (patch) | |
tree | c46c2258f054760cdd163d2145abc4f3dbb140ff /Userland/Libraries/LibGUI/TextDocument.cpp | |
parent | 67537bfc80e0efefd555bf1b5cda4eac1a01fbdb (diff) | |
download | serenity-928f16d3608138480def073188210e7c3b6790a2.zip |
LibGUI: Remember modified state on undo/redo actions
Diffstat (limited to 'Userland/Libraries/LibGUI/TextDocument.cpp')
-rw-r--r-- | Userland/Libraries/LibGUI/TextDocument.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Userland/Libraries/LibGUI/TextDocument.cpp b/Userland/Libraries/LibGUI/TextDocument.cpp index 27042d1696..f42cfa4624 100644 --- a/Userland/Libraries/LibGUI/TextDocument.cpp +++ b/Userland/Libraries/LibGUI/TextDocument.cpp @@ -26,7 +26,7 @@ TextDocument::TextDocument(Client* client) if (client) m_clients.set(client); append_line(make<TextDocumentLine>(*this)); - set_modified(false); + set_unmodified(); m_undo_timer = Core::Timer::create_single_shot( 2000, [this] { @@ -94,7 +94,7 @@ bool TextDocument::set_text(const StringView& text) clear_text_guard.disarm(); // FIXME: Should the modified state be cleared on some of the earlier returns as well? - set_modified(false); + set_unmodified(); return true; } @@ -309,8 +309,6 @@ void TextDocument::update_views(Badge<TextDocumentLine>) void TextDocument::notify_did_change() { - set_modified(true); - if (m_undo_timer) m_undo_timer->restart(); @@ -887,9 +885,9 @@ const TextDocumentSpan* TextDocument::span_at(const TextPosition& position) cons return nullptr; } -void TextDocument::set_modified(bool modified) +void TextDocument::set_unmodified() { - m_modified = modified; + m_undo_stack.set_current_unmodified(); } } |