mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[escher] TextField: make the handleEventWithText behaviour consistent:
when a text cannot be inserted because it overflows the buffer, don't add anything insertTextAtLocation already behaves like this but handleEventWithText used to cap the inserted text which sometimes leads to a different behaviour - it would insert a truncated text
This commit is contained in:
@@ -492,7 +492,13 @@ bool TextField::handleEventWithText(const char * eventText, bool indentation, bo
|
||||
char buffer[bufferSize];
|
||||
{
|
||||
CodePoint c[] = {UCodePointEmpty, '\n'};
|
||||
UTF8Helper::CopyAndRemoveCodePoints(buffer, bufferSize, eventText, c, 2);
|
||||
bool complete = UTF8Helper::CopyAndRemoveCodePoints(buffer, bufferSize, eventText, c, 2);
|
||||
/* If the text is too long to be stored in buffer, we do not insert any
|
||||
* text. This behaviour is consistent with 'insertTextAtLocation'
|
||||
* behaviour. */
|
||||
if (!complete) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Replace System parentheses (used to keep layout tree structure) by normal parentheses
|
||||
Poincare::SerializationHelper::ReplaceSystemParenthesesByUserParentheses(buffer);
|
||||
|
||||
Reference in New Issue
Block a user