summaryrefslogtreecommitdiff
path: root/Libraries/LibGUI/TextDocument.h
diff options
context:
space:
mode:
authorItamar <itamar8910@gmail.com>2020-08-15 10:58:31 +0300
committerAndreas Kling <kling@serenityos.org>2020-08-15 15:06:35 +0200
commit627f258c9753902b733d94db6924852111ac3d9b (patch)
treee6e7fa86e4e9a28ba299ea4259b00a75fd73a7e2 /Libraries/LibGUI/TextDocument.h
parente793cc3d1312c48f1f994a5eeec9f7a1d18487f3 (diff)
downloadserenity-627f258c9753902b733d94db6924852111ac3d9b.zip
HackStudio: Use CodeDocument instead of TextDocument
This commit adds a new GUI widget type, called CodeDocument, which is a TextDocument that can additionaly store data related to the debugger. This fixes various bugs and crashes that occured when we switched between files in debug mode, because we previously held stale breakpoint data for the previous file in the Editor object. We now keep this data at the "document" level rather than the Editor level, which fixes things.
Diffstat (limited to 'Libraries/LibGUI/TextDocument.h')
-rw-r--r--Libraries/LibGUI/TextDocument.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/Libraries/LibGUI/TextDocument.h b/Libraries/LibGUI/TextDocument.h
index ff5f8e6cc3..5a061da3b0 100644
--- a/Libraries/LibGUI/TextDocument.h
+++ b/Libraries/LibGUI/TextDocument.h
@@ -75,7 +75,7 @@ public:
};
static NonnullRefPtr<TextDocument> create(Client* client = nullptr);
- ~TextDocument();
+ virtual ~TextDocument();
size_t line_count() const { return m_lines.size(); }
const TextDocumentLine& line(size_t line_index) const { return m_lines[line_index]; }
@@ -137,9 +137,12 @@ public:
TextPosition insert_at(const TextPosition&, const StringView&, const Client* = nullptr);
void remove(const TextRange&);
-private:
+ virtual bool is_code_document() const { return false; }
+
+protected:
explicit TextDocument(Client* client);
+private:
void update_undo_timer();
NonnullOwnPtrVector<TextDocumentLine> m_lines;