summaryrefslogtreecommitdiff
path: root/plugingui
diff options
context:
space:
mode:
Diffstat (limited to 'plugingui')
-rw-r--r--plugingui/textedit.cc9
-rw-r--r--plugingui/textedit.h1
2 files changed, 9 insertions, 1 deletions
diff --git a/plugingui/textedit.cc b/plugingui/textedit.cc
index b7603a1..4de6e52 100644
--- a/plugingui/textedit.cc
+++ b/plugingui/textedit.cc
@@ -54,6 +54,8 @@ TextEdit::~TextEdit()
void TextEdit::resize(std::size_t width, std::size_t height)
{
Widget::resize(width, height);
+
+ needs_preprocessing = true;
scroll.resize(scroll.width(), height - 14);
scroll.move(width - 23, 7);
}
@@ -72,7 +74,7 @@ void TextEdit::setText(const std::string& text)
{
_text = text;
- preprocessText();
+ needs_preprocessing = true;
redraw();
textChangedNotifier();
}
@@ -144,6 +146,11 @@ void TextEdit::preprocessText()
void TextEdit::repaintEvent(RepaintEvent* repaintEvent)
{
+ if(needs_preprocessing)
+ {
+ preprocessText();
+ }
+
Painter p(*this);
// update values of scroll bar
diff --git a/plugingui/textedit.h b/plugingui/textedit.h
index 81e00b8..5959ae9 100644
--- a/plugingui/textedit.h
+++ b/plugingui/textedit.h
@@ -76,6 +76,7 @@ private:
std::string _text;
bool readonly{true};
+ bool needs_preprocessing{false};
std::list< std::string > preprocessedtext;
};