[code] Avoid init/deinit-ing uPy in each editor redraw

This commit is contained in:
Romain Goyet
2018-06-04 14:57:10 +02:00
committed by EmilieNumworks
parent b52590e2f7
commit caff93cda0
4 changed files with 24 additions and 16 deletions

View File

@@ -12,11 +12,18 @@ public:
m_contentView(fontSize)
{
}
void loadSyntaxHighlighter() { m_contentView.loadSyntaxHighlighter(); }
void unloadSyntaxHighlighter() { m_contentView.unloadSyntaxHighlighter(); }
protected:
class ContentView : public TextArea::ContentView {
public:
ContentView(KDText::FontSize fontSize);
~ContentView();
ContentView(KDText::FontSize fontSize) :
TextArea::ContentView(fontSize),
m_pythonHeap(nullptr)
{
}
void loadSyntaxHighlighter();
void unloadSyntaxHighlighter();
void clearRect(KDContext * ctx, KDRect rect) const override;
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;
@@ -27,7 +34,6 @@ protected:
private:
const ContentView * nonEditableContentView() const override { return &m_contentView; }
ContentView m_contentView;
char * m_pythonHeap;
};
}