1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:57:44 +00:00

LibGUI: Track modified state in GUI::TextDocument

Until now, this has been hackishly tracked by the TextEditor app's
main widget. Let's do it in GUI::TextDocument instead, so that anyone
who uses this class can know whether it's modified or not.
This commit is contained in:
Andreas Kling 2021-05-01 18:50:01 +02:00
parent 443775754f
commit 5b68a76c77
2 changed files with 14 additions and 0 deletions

View file

@ -122,6 +122,8 @@ public:
virtual bool is_code_document() const { return false; }
bool is_empty() const;
bool is_modified() const { return m_modified; }
void set_modified(bool);
protected:
explicit TextDocument(Client* client);
@ -134,6 +136,7 @@ private:
HashTable<Client*> m_clients;
bool m_client_notifications_enabled { true };
bool m_modified { false };
UndoStack m_undo_stack;
RefPtr<Core::Timer> m_undo_timer;