1
0
Fork 0
mirror of https://gitlab.com/Mr_Goldberg/goldberg_emulator.git synced 2024-11-14 10:50:13 +01:00

Fix input select going out of bound

This commit is contained in:
Nemirtingas 2019-08-03 13:44:33 +02:00
parent 4f9e67d700
commit 804355fa54
2 changed files with 11 additions and 0 deletions

View file

@ -1700,6 +1700,11 @@ int ImTextStrFromUtf8(ImWchar* buf, int buf_size, const char* in_text, const cha
while (buf_out < buf_end-1 && (!in_text_end || in_text < in_text_end) && *in_text) while (buf_out < buf_end-1 && (!in_text_end || in_text < in_text_end) && *in_text)
{ {
unsigned int c; unsigned int c;
if (*in_text == 1)
{
in_text += 9;
continue;
}
in_text += ImTextCharFromUtf8(&c, in_text, in_text_end); in_text += ImTextCharFromUtf8(&c, in_text, in_text_end);
if (c == 0) if (c == 0)
break; break;

View file

@ -3097,6 +3097,12 @@ static ImVec2 InputTextCalcTextSizeW(const ImWchar* text_begin, const ImWchar* t
if (c == '\r') if (c == '\r')
continue; continue;
if (*s == 1)
{
s += 9;
continue;
}
const float char_width = font->GetCharAdvance((ImWchar)c) * scale; const float char_width = font->GetCharAdvance((ImWchar)c) * scale;
line_width += char_width; line_width += char_width;
} }