mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 22:57:44 +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:
parent
e793cc3d13
commit
627f258c97
9 changed files with 137 additions and 22 deletions
|
@ -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;
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
const TextDocument& document() const { return *m_document; }
|
||||
TextDocument& document() { return *m_document; }
|
||||
|
||||
void set_document(TextDocument&);
|
||||
virtual void set_document(TextDocument&);
|
||||
|
||||
bool has_visible_list() const { return m_has_visible_list; }
|
||||
void set_has_visible_list(bool);
|
||||
|
@ -175,7 +175,7 @@ protected:
|
|||
virtual void context_menu_event(ContextMenuEvent&) override;
|
||||
virtual void resize_event(ResizeEvent&) override;
|
||||
virtual void theme_change_event(ThemeChangeEvent&) override;
|
||||
virtual void cursor_did_change() { }
|
||||
virtual void cursor_did_change() {}
|
||||
Gfx::IntRect ruler_content_rect(size_t line) const;
|
||||
|
||||
TextPosition text_position_at(const Gfx::IntPoint&) const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue