mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-20 22:30:30 +01:00
[code] Get rid of malloc: keep a buffer in Code::App to be used as python heap
This commit is contained in:
@@ -5,11 +5,13 @@
|
||||
|
||||
namespace Code {
|
||||
|
||||
class App;
|
||||
|
||||
class PythonTextArea : public TextArea {
|
||||
public:
|
||||
PythonTextArea(Responder * parentResponder, KDText::FontSize fontSize) :
|
||||
PythonTextArea(Responder * parentResponder, App * pythonDelegate, KDText::FontSize fontSize) :
|
||||
TextArea(parentResponder, &m_contentView, fontSize),
|
||||
m_contentView(fontSize)
|
||||
m_contentView(pythonDelegate, fontSize)
|
||||
{
|
||||
}
|
||||
void loadSyntaxHighlighter() { m_contentView.loadSyntaxHighlighter(); }
|
||||
@@ -17,9 +19,9 @@ public:
|
||||
protected:
|
||||
class ContentView : public TextArea::ContentView {
|
||||
public:
|
||||
ContentView(KDText::FontSize fontSize) :
|
||||
ContentView(App * pythonDelegate, KDText::FontSize fontSize) :
|
||||
TextArea::ContentView(fontSize),
|
||||
m_pythonHeap(nullptr)
|
||||
m_pythonDelegate(pythonDelegate)
|
||||
{
|
||||
}
|
||||
void loadSyntaxHighlighter();
|
||||
@@ -28,8 +30,7 @@ protected:
|
||||
void drawLine(KDContext * ctx, int line, const char * text, size_t length, int fromColumn, int toColumn) const override;
|
||||
KDRect dirtyRectFromCursorPosition(size_t index, bool lineBreak) const override;
|
||||
private:
|
||||
static constexpr size_t k_pythonHeapSize = 4096;
|
||||
char * m_pythonHeap;
|
||||
App * m_pythonDelegate;
|
||||
};
|
||||
private:
|
||||
const ContentView * nonEditableContentView() const override { return &m_contentView; }
|
||||
|
||||
Reference in New Issue
Block a user