| 8146 | } |
| 8147 | |
| 8148 | static int InputTextCalcTextLenAndLineCount(const char* text_begin, const char** out_text_end) |
| 8149 | { |
| 8150 | int line_count = 0; |
| 8151 | const char* s = text_begin; |
| 8152 | while (char c = *s++) // We are only matching for \n so we can ignore UTF-8 decoding |
| 8153 | if (c == '\n') |
| 8154 | line_count++; |
| 8155 | s--; |
| 8156 | if (s[0] != '\n' && s[0] != '\r') |
| 8157 | line_count++; |
| 8158 | *out_text_end = s; |
| 8159 | return line_count; |
| 8160 | } |
| 8161 | |
| 8162 | static ImVec2 InputTextCalcTextSizeW(const ImWchar* text_begin, const ImWchar* text_end, const ImWchar** remaining, ImVec2* out_offset, bool stop_on_new_line) |
| 8163 | { |