|
|
|
@ -5402,10 +5402,9 @@ bool ImGui::InputText(const char* label, char* buf, size_t buf_size, ImGuiInputT
|
|
|
|
|
for (const char* s = clipboard; *s; )
|
|
|
|
|
{
|
|
|
|
|
unsigned int c;
|
|
|
|
|
const int bytes_count = ImTextCharFromUtf8(&c, s, NULL);
|
|
|
|
|
if (bytes_count <= 0)
|
|
|
|
|
s += ImTextCharFromUtf8(&c, s, NULL);
|
|
|
|
|
if (c == 0)
|
|
|
|
|
break;
|
|
|
|
|
s += bytes_count;
|
|
|
|
|
if (c >= 0x10000)
|
|
|
|
|
continue;
|
|
|
|
|
if (InputTextFilterCharacter((ImWchar)c, flags))
|
|
|
|
@ -7351,8 +7350,6 @@ const ImFont::Glyph* ImFont::FindGlyph(unsigned short c) const
|
|
|
|
|
// Convert UTF-8 to 32-bits character, process single character input.
|
|
|
|
|
// Based on stb_from_utf8() from github.com/nothings/stb/
|
|
|
|
|
static int ImTextCharFromUtf8(unsigned int* out_char, const char* in_text, const char* in_text_end)
|
|
|
|
|
{
|
|
|
|
|
if (*in_text != 0)
|
|
|
|
|
{
|
|
|
|
|
unsigned int c = (unsigned int)-1;
|
|
|
|
|
const unsigned char* str = (const unsigned char*)in_text;
|
|
|
|
@ -7403,7 +7400,6 @@ static int ImTextCharFromUtf8(unsigned int* out_char, const char* in_text, const
|
|
|
|
|
*out_char = c;
|
|
|
|
|
return 4;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
*out_char = 0;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
@ -7535,8 +7531,7 @@ const char* ImFont::CalcWordWrapPositionA(float scale, const char* text, const c
|
|
|
|
|
while (s < text_end)
|
|
|
|
|
{
|
|
|
|
|
unsigned int c;
|
|
|
|
|
const int bytes_count = ImTextCharFromUtf8(&c, s, text_end);
|
|
|
|
|
const char* next_s = s + (bytes_count > 0 ? bytes_count : 1);
|
|
|
|
|
const char* next_s = s + ImTextCharFromUtf8(&c, s, text_end);
|
|
|
|
|
|
|
|
|
|
if (c == '\n')
|
|
|
|
|
{
|
|
|
|
@ -7637,8 +7632,7 @@ ImVec2 ImFont::CalcTextSizeA(float size, float max_width, float wrap_width, cons
|
|
|
|
|
|
|
|
|
|
// Decode and advance source (handle unlikely UTF-8 decoding failure by skipping to the next byte)
|
|
|
|
|
unsigned int c;
|
|
|
|
|
const int bytes_count = ImTextCharFromUtf8(&c, s, text_end);
|
|
|
|
|
s += bytes_count > 0 ? bytes_count : 1;
|
|
|
|
|
s += ImTextCharFromUtf8(&c, s, text_end);
|
|
|
|
|
|
|
|
|
|
if (c == '\n')
|
|
|
|
|
{
|
|
|
|
@ -7767,8 +7761,7 @@ void ImFont::RenderText(float size, ImVec2 pos, ImU32 col, const ImVec4& clip_re
|
|
|
|
|
|
|
|
|
|
// Decode and advance source (handle unlikely UTF-8 decoding failure by skipping to the next byte)
|
|
|
|
|
unsigned int c;
|
|
|
|
|
const int bytes_count = ImTextCharFromUtf8(&c, s, text_end);
|
|
|
|
|
s += bytes_count > 0 ? bytes_count : 1;
|
|
|
|
|
s += ImTextCharFromUtf8(&c, s, text_end);
|
|
|
|
|
|
|
|
|
|
if (c == '\n')
|
|
|
|
|
{
|
|
|
|
|