1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:27:35 +00:00

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.
This commit is contained in:
Itamar 2020-08-15 10:58:31 +03:00 committed by Andreas Kling
parent e793cc3d13
commit 627f258c97
9 changed files with 137 additions and 22 deletions

View file

@ -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;