diff --git a/imgui.cpp b/imgui.cpp index 1d47e58..9b0cfdd 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -9714,12 +9714,20 @@ if (c == 0) break; - if (c == '\n') + if (c < 32) { - line_width = word_width = blank_width = 0.0f; - inside_word = true; - s = next_s; - continue; + if (c == '\n') + { + line_width = word_width = blank_width = 0.0f; + inside_word = true; + s = next_s; + continue; + } + if (c == '\r') + { + s = next_s; + continue; + } } const float char_width = ((size_t)c < IndexXAdvance.size()) ? IndexXAdvance[(size_t)c] * scale : FallbackXAdvance; @@ -9825,12 +9833,17 @@ break; } - if (c == '\n') + if (c < 32) { - text_size.x = ImMax(text_size.x, line_width); - text_size.y += line_height; - line_width = 0.0f; - continue; + if (c == '\n') + { + text_size.x = ImMax(text_size.x, line_width); + text_size.y += line_height; + line_width = 0.0f; + continue; + } + if (c == '\r') + continue; } const float char_width = ((size_t)c < IndexXAdvance.size()) ? IndexXAdvance[(size_t)c] * scale : FallbackXAdvance; @@ -9872,12 +9885,17 @@ { const unsigned int c = (unsigned int)(*s++); - if (c == '\n') + if (c < 32) { - text_size.x = ImMax(text_size.x, line_width); - text_size.y += line_height; - line_width = 0.0f; - continue; + if (c == '\n') + { + text_size.x = ImMax(text_size.x, line_width); + text_size.y += line_height; + line_width = 0.0f; + continue; + } + if (c == '\r') + continue; } const float char_width = ((size_t)c < IndexXAdvance.size()) ? IndexXAdvance[(size_t)c] * scale : FallbackXAdvance; @@ -9971,11 +9989,16 @@ break; } - if (c == '\n') + if (c < 32) { - x = pos.x; - y += line_height; - continue; + if (c == '\n') + { + x = pos.x; + y += line_height; + continue; + } + if (c == '\r') + continue; } float char_width = 0.0f;