Optimization

This commit is contained in:
Bertrand Songis
2020-09-25 17:16:38 +02:00
parent 7c5aa513e5
commit ce74048a51
5 changed files with 24 additions and 13 deletions
+6 -3
View File
@@ -85,12 +85,14 @@ void TextEdit::onEvent(event_t event)
value[length - 1] = '\0';
--cursorPos;
invalidate();
changed = true;
}
}
else if (cursorPos < length) {
memmove(value + cursorPos + 1, value + cursorPos, length - cursorPos - 1);
value[cursorPos++] = c;
invalidate();
changed = true;
}
}
#endif
@@ -130,8 +132,10 @@ void TextEdit::onEvent(event_t event)
case EVT_KEY_BREAK(KEY_ENTER):
if (cursorPos < length - 1) {
cursorPos++;
if (value[cursorPos] == '\0')
if (value[cursorPos] == '\0') {
value[cursorPos] = ' ';
changed = true;
}
invalidate();
}
else {
@@ -171,7 +175,7 @@ void TextEdit::onEvent(event_t event)
// TRACE("value[%d] = %d", cursorPos, v);
value[cursorPos] = v;
invalidate();
// TODO storageDirty(...);
changed = true;
}
}
else {
@@ -216,6 +220,5 @@ void TextEdit::onFocusLost()
changeEnd();
// TODO storageDirty(...);
FormField::onFocusLost();
}