diff --git a/imgui.cpp b/imgui.cpp index c871445..4c8812b 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -2997,7 +2997,7 @@ ImGuiWindow* window = GImGui->CurrentWindow; if (wrap_pos_x == 0.0f) - wrap_pos_x = GetContentRegionMaxAbs().x; + wrap_pos_x = window->WorkRect.Max.x; else if (wrap_pos_x > 0.0f) wrap_pos_x += window->Pos.x - window->Scroll.x; // wrap_pos_x is provided is window local space diff --git a/imgui.cpp b/imgui.cpp index c871445..4c8812b 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -2997,7 +2997,7 @@ ImGuiWindow* window = GImGui->CurrentWindow; if (wrap_pos_x == 0.0f) - wrap_pos_x = GetContentRegionMaxAbs().x; + wrap_pos_x = window->WorkRect.Max.x; else if (wrap_pos_x > 0.0f) wrap_pos_x += window->Pos.x - window->Scroll.x; // wrap_pos_x is provided is window local space diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 294e6f0..c8d7b83 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -2154,6 +2154,7 @@ static bool show_h_scrollbar = true; static bool show_button = true; static bool show_tree_nodes = true; + static bool show_text_wrapped = false; static bool show_columns = true; static bool show_tab_bar = true; static bool explicit_content_size = false; @@ -2167,6 +2168,7 @@ ImGui::Checkbox("H-scrollbar", &show_h_scrollbar); ImGui::Checkbox("Button", &show_button); // Will grow contents size (unless explicitly overwritten) ImGui::Checkbox("Tree nodes", &show_tree_nodes); // Will grow contents size and display highlight over full width + ImGui::Checkbox("Text wrapped", &show_text_wrapped);// Will grow and use contents size ImGui::Checkbox("Columns", &show_columns); // Will use contents size ImGui::Checkbox("Tab bar", &show_tab_bar); // Will use contents size ImGui::Checkbox("Explicit content size", &explicit_content_size); @@ -2200,6 +2202,10 @@ } ImGui::CollapsingHeader("CollapsingHeader", &open); } + if (show_text_wrapped) + { + ImGui::TextWrapped("This text should automatically wrap on the edge of the work rectangle."); + } if (show_columns) { ImGui::Columns(4);