mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 12:25:06 +00:00
LibGUI: Support multiple GTextEditors editing the same GTextDocument
With this patch, you can now assign the same GTextDocument to multiple GTextEditor widgets via GTextEditor::set_document(). The editors have independent cursors and selection, but all changes are shared, and immediately propagate to all editors. This is very unoptimized and will do lots of unnecessary invalidation, especially line re-wrapping and repainting over and over again.
This commit is contained in:
parent
f96c683543
commit
9b13a3905b
4 changed files with 101 additions and 58 deletions
|
@ -37,6 +37,8 @@ public:
|
|||
const GTextDocument& document() const { return *m_document; }
|
||||
GTextDocument& document() { return *m_document; }
|
||||
|
||||
void set_document(GTextDocument&);
|
||||
|
||||
bool is_readonly() const { return m_readonly; }
|
||||
void set_readonly(bool);
|
||||
|
||||
|
@ -131,10 +133,12 @@ protected:
|
|||
private:
|
||||
friend class GTextDocumentLine;
|
||||
|
||||
// ^GTextDocument::Client
|
||||
virtual void document_did_append_line() override;
|
||||
virtual void document_did_insert_line(int) override;
|
||||
virtual void document_did_remove_line(int) override;
|
||||
virtual void document_did_remove_all_lines() override;
|
||||
virtual void document_did_change() override;
|
||||
|
||||
void create_actions();
|
||||
void paint_ruler(Painter&);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue