ImStrv: Step 2 - change ImStrv typedef to struct, perform all other logic conversion.

Squashed commits (initially a commit from rokups + many rework by ocornut. keeping them separate commits made rebasing unnecessarily tricking so merged from 2024/02)
ImStrv: many fixes (see details), added imconfig class extension example, added natvis description.
ImStrv: rework toward ensuring End is always set to constant can be compile time calculated
ImStrv: using length(), fix ambiguous empty() function, fix altered behaviors, removed unused operators.
ImStrv: various tweaks and fixes. removed ImGuiTextRange from ImGuiTextFilter, fix test engine hooks, removed constructor only used twice.
This commit is contained in:
ocornut
2020-08-24 11:37:01 +03:00
committed by ocornut
parent 327ae2b2e2
commit 9a1c0ce98c
9 changed files with 551 additions and 426 deletions

View File

@@ -5124,7 +5124,7 @@ static void DemoWindowLayout()
case 2:
ImVec4 clip_rect(p0.x, p0.y, p1.x, p1.y); // AddText() takes a ImVec4* here so let's convert.
draw_list->AddRectFilled(p0, p1, IM_COL32(90, 90, 120, 255));
draw_list->AddText(ImGui::GetFont(), ImGui::GetFontSize(), text_pos, IM_COL32_WHITE, text_str, NULL, 0.0f, &clip_rect);
draw_list->AddText(ImGui::GetFont(), ImGui::GetFontSize(), text_pos, IM_COL32_WHITE, text_str, 0.0f, &clip_rect);
break;
}
}
@@ -9068,7 +9068,7 @@ struct ExampleAppConsole
if (match_len > 0)
{
data->DeleteChars((int)(word_start - data->Buf), (int)(word_end - word_start));
data->InsertChars(data->CursorPos, candidates[0], candidates[0] + match_len);
data->InsertChars(data->CursorPos, ImStrv(candidates[0], candidates[0] + match_len));
}
// List matches
@@ -9203,8 +9203,8 @@ struct ExampleAppLog
{
const char* line_start = buf + LineOffsets[line_no];
const char* line_end = (line_no + 1 < LineOffsets.Size) ? (buf + LineOffsets[line_no + 1] - 1) : buf_end;
if (Filter.PassFilter(line_start, line_end))
ImGui::TextUnformatted(line_start, line_end);
if (Filter.PassFilter(ImStrv(line_start, line_end)))
ImGui::TextUnformatted(ImStrv(line_start, line_end));
}
}
else
@@ -9230,7 +9230,7 @@ struct ExampleAppLog
{
const char* line_start = buf + LineOffsets[line_no];
const char* line_end = (line_no + 1 < LineOffsets.Size) ? (buf + LineOffsets[line_no + 1] - 1) : buf_end;
ImGui::TextUnformatted(line_start, line_end);
ImGui::TextUnformatted(ImStrv(line_start, line_end));
}
}
clipper.End();
@@ -9535,7 +9535,7 @@ static void ShowExampleAppLongText(bool* p_open)
{
case 0:
// Single call to TextUnformatted() with a big buffer
ImGui::TextUnformatted(log.begin(), log.end());
ImGui::TextUnformatted(ImStrv(log.begin(), log.end()));
break;
case 1:
{