Begin: Move code from BeginChild() to EndChild() to allow End() calling EndChild() in new-begin experiments.
diff --git a/imgui.cpp b/imgui.cpp
index 34b7634..8531fbb 100644
--- a/imgui.cpp
+++ b/imgui.cpp
@@ -5124,11 +5124,6 @@
     child_window->ChildId = id;
     child_window->AutoFitChildAxises = (ImS8)auto_fit_axises;
 
-    // Set the cursor to handle case where the user called SetNextWindowPos()+BeginChild() manually.
-    // While this is not really documented/defined, it seems that the expected thing to do.
-    if (child_window->BeginCount == 1)
-        parent_window->DC.CursorPos = child_window->Pos;
-
     // Process navigation-in immediately so NavInit can run on first frame
     if (g.NavActivateId == id && !(flags & ImGuiWindowFlags_NavFlattened) && (child_window->DC.NavLayerActiveMask != 0 || child_window->DC.NavHasScroll))
     {
@@ -5160,6 +5155,11 @@
     IM_ASSERT(g.WithinEndChild == false);
     IM_ASSERT(window->Flags & ImGuiWindowFlags_ChildWindow);   // Mismatched BeginChild()/EndChild() calls
 
+    // Set the cursor to handle case where the user called SetNextWindowPos()+BeginChild() manually.
+    // While this is not really documented/defined, it seems that the expected thing to do.
+    if (window->BeginCount == 1)
+        window->ParentWindow->DC.CursorPos = window->Pos;
+
     g.WithinEndChild = true;
     if (window->BeginCount > 1)
     {