diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 5bafc13c5..d0800a085 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -4110,12 +4110,12 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, const ImVec2 & pos, I // FIXME-OPT: This is not optimal as do first do a search for \n before calling CalcWordWrapPositionA(). // If the specs for CalcWordWrapPositionA() were reworked to optionally return on \n we could combine both. // However it is still better than nothing performing the fast-forward! - s = CalcWordWrapPositionA(scale, s, line_end, wrap_width); - s = CalcWordWrapNextLineStartA(s, text.End); + s = CalcWordWrapPositionA(scale, ImStrv(s, line_end), wrap_width); + s = CalcWordWrapNextLineStartA(s, text_end); } else { - s = line_end ? line_end + 1 : text.End; + s = line_end ? line_end + 1 : text_end; } y += line_height; } diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 65bbcbead..0641e6bf6 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -1832,7 +1832,7 @@ bool ImGui::BeginCombo(ImStrv label, ImStrv preview_value, ImGuiComboFlags flags const float arrow_size = (flags & ImGuiComboFlags_NoArrowButton) ? 0.0f : GetFrameHeight(); const ImVec2 label_size = CalcTextSize(label, true); - const float preview_width = ((flags & ImGuiComboFlags_WidthFitPreview) && (preview_value != NULL)) ? CalcTextSize(preview_value, true).x : 0.0f; + const float preview_width = ((flags & ImGuiComboFlags_WidthFitPreview) && preview_value) ? CalcTextSize(preview_value, true).x : 0.0f; const float w = (flags & ImGuiComboFlags_NoPreview) ? arrow_size : ((flags & ImGuiComboFlags_WidthFitPreview) ? (arrow_size + preview_width + style.FramePadding.x * 2.0f) : CalcItemWidth()); const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y * 2.0f)); const ImRect total_bb(bb.Min, bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f)); @@ -1871,7 +1871,7 @@ bool ImGui::BeginCombo(ImStrv label, ImStrv preview_value, ImGuiComboFlags flags if (flags & ImGuiComboFlags_CustomPreview) { g.ComboPreviewData.PreviewRect = ImRect(bb.Min.x, bb.Min.y, value_x2, bb.Max.y); - IM_ASSERT(!preview_value); + IM_ASSERT(preview_value.empty()); } // Render preview and label