1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:38:11 +00:00

HackStudio: Support opening the same file in both editors

Hey, it actually works! You can now edit the same file in both editors
and even the C++ highlighting updates correctly in both of them. :^)
This commit is contained in:
Andreas Kling 2019-10-27 19:39:15 +01:00
parent 9b13a3905b
commit e2d7f585da
5 changed files with 26 additions and 7 deletions

View file

@ -4,6 +4,7 @@
#include <AK/NonnullRefPtr.h>
#include <AK/RefCounted.h>
#include <AK/String.h>
#include <LibGUI/GTextDocument.h>
class TextDocument : public RefCounted<TextDocument> {
public:
@ -18,6 +19,8 @@ public:
Vector<int> find(const StringView&) const;
const GTextDocument& document() const;
private:
explicit TextDocument(const String& name)
: m_name(name)
@ -26,4 +29,5 @@ private:
String m_name;
mutable ByteBuffer m_contents;
mutable RefPtr<GTextDocument> m_document;
};