TextUnformatted() fixed clipping bug in the large-text path when horizontal scroll has been applied (#692, #246)

This commit is contained in:
ocornut 2016-06-12 12:23:16 +02:00
parent d79186931e
commit 9f21c7189f

View File

@ -5310,7 +5310,7 @@ void ImGui::TextUnformatted(const char* text, const char* text_end)
// Lines to render // Lines to render
if (line < text_end) if (line < text_end)
{ {
ImRect line_rect(pos, pos + ImVec2(GetWindowWidth(), line_height)); ImRect line_rect(pos, pos + ImVec2(FLT_MAX, line_height));
while (line < text_end) while (line < text_end)
{ {
const char* line_end = strchr(line, '\n'); const char* line_end = strchr(line, '\n');
@ -9675,6 +9675,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
if (!ImGui::TreeNode(window, "%s '%s', %d @ 0x%p", label, window->Name, window->Active || window->WasActive, window)) if (!ImGui::TreeNode(window, "%s '%s', %d @ 0x%p", label, window->Name, window->Active || window->WasActive, window))
return; return;
NodeDrawList(window->DrawList, "DrawList"); NodeDrawList(window->DrawList, "DrawList");
ImGui::BulletText("Size: (%.1f,%.1f), SizeContents (%.1f,%.1f)", window->Size.x, window->Size.y, window->SizeContents.x, window->SizeContents.y);
if (window->RootWindow != window) NodeWindow(window->RootWindow, "RootWindow"); if (window->RootWindow != window) NodeWindow(window->RootWindow, "RootWindow");
if (window->DC.ChildWindows.Size > 0) NodeWindows(window->DC.ChildWindows, "ChildWindows"); if (window->DC.ChildWindows.Size > 0) NodeWindows(window->DC.ChildWindows, "ChildWindows");
ImGui::BulletText("Storage: %d bytes", window->StateStorage.Data.Size * (int)sizeof(ImGuiStorage::Pair)); ImGui::BulletText("Storage: %d bytes", window->StateStorage.Data.Size * (int)sizeof(ImGuiStorage::Pair));