Internals: Renamed IsCharIsSpace() to IsCharIsBlank*() to match standard terminlogy and added ascii/u16 variations.

This commit is contained in:
omar
2018-05-03 11:57:51 +02:00
parent ef05141a06
commit a62f195e83
3 changed files with 10 additions and 9 deletions

View File

@ -8490,7 +8490,7 @@ static size_t GDataTypeSize[ImGuiDataType_COUNT] =
// NB: This is _not_ a full expression evaluator. We should probably add one and replace this dumb mess..
static bool DataTypeApplyOpFromText(const char* buf, const char* initial_value_buf, ImGuiDataType data_type, void* data_ptr, const char* scalar_format)
{
while (ImCharIsSpace((unsigned int)*buf))
while (ImCharIsBlankA(*buf))
buf++;
// We don't support '-' op because it would conflict with inputing negative value.
@ -8499,7 +8499,7 @@ static bool DataTypeApplyOpFromText(const char* buf, const char* initial_value_b
if (op == '+' || op == '*' || op == '/')
{
buf++;
while (ImCharIsSpace((unsigned int)*buf))
while (ImCharIsBlankA(*buf))
buf++;
}
else
@ -9771,7 +9771,7 @@ static void STB_TEXTEDIT_LAYOUTROW(StbTexteditRow* r, STB_TEXTEDIT_STRING* ob
r->num_chars = (int)(text_remaining - (text + line_start_idx));
}
static bool is_separator(unsigned int c) { return ImCharIsSpace(c) || c==',' || c==';' || c=='(' || c==')' || c=='{' || c=='}' || c=='[' || c==']' || c=='|'; }
static bool is_separator(unsigned int c) { return ImCharIsBlankW(c) || c==',' || c==';' || c=='(' || c==')' || c=='{' || c=='}' || c=='[' || c==']' || c=='|'; }
static int is_word_boundary_from_right(STB_TEXTEDIT_STRING* obj, int idx) { return idx > 0 ? (is_separator( obj->Text[idx-1] ) && !is_separator( obj->Text[idx] ) ) : 1; }
static int STB_TEXTEDIT_MOVEWORDLEFT_IMPL(STB_TEXTEDIT_STRING* obj, int idx) { idx--; while (idx >= 0 && !is_word_boundary_from_right(obj, idx)) idx--; return idx < 0 ? 0 : idx; }
#ifdef __APPLE__ // FIXME: Move setting to IO structure
@ -9925,7 +9925,7 @@ static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags f
*p_char = (c += (unsigned int)('A'-'a'));
if (flags & ImGuiInputTextFlags_CharsNoBlank)
if (ImCharIsSpace(c))
if (ImCharIsBlankW(c))
return false;
}
@ -11826,7 +11826,7 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
{
value_changed = true;
char* p = buf;
while (*p == '#' || ImCharIsSpace((unsigned int)*p))
while (*p == '#' || ImCharIsBlankA(*p))
p++;
i[0] = i[1] = i[2] = i[3] = 0;
if (alpha)