mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Fix unicode pasting in DoEditBox
This commit is contained in:
parent
a3a363f665
commit
44c699b812
|
@ -249,12 +249,16 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS
|
||||||
{
|
{
|
||||||
int Offset = str_length(pStr);
|
int Offset = str_length(pStr);
|
||||||
int CharsLeft = StrSize - Offset - 1;
|
int CharsLeft = StrSize - Offset - 1;
|
||||||
for(int i = 0; i < str_length(Text) && i < CharsLeft; i++)
|
char *pCur = pStr + Offset;
|
||||||
|
str_utf8_copy(pCur, Text, CharsLeft);
|
||||||
|
for(int i = 0; i < CharsLeft; i++)
|
||||||
{
|
{
|
||||||
if(Text[i] == '\n')
|
if(pCur[i] == 0)
|
||||||
pStr[i + Offset] = ' ';
|
break;
|
||||||
else
|
else if(pCur[i] == '\r')
|
||||||
pStr[i + Offset] = Text[i];
|
pCur[i] = ' ';
|
||||||
|
else if(pCur[i] == '\n')
|
||||||
|
pCur[i] = ' ';
|
||||||
}
|
}
|
||||||
s_AtIndex = str_length(pStr);
|
s_AtIndex = str_length(pStr);
|
||||||
ReturnValue = true;
|
ReturnValue = true;
|
||||||
|
|
Loading…
Reference in a new issue