Structural reparent → lock-to-source. More...
#include <inspector_overlay.hpp>
Public Attributes | |
| std::string | child_anchor |
| std::string | new_parent_anchor |
| std::string | insert_after_anchor |
Structural reparent → lock-to-source.
A reflow-aware drop that lands a view INSIDE a different container is a STRUCTURAL tree edit, not a style tweak. The live View tree reparents + undoes via EditHistory (handled below), but the generated source must also be rewritten so the change persists across a fresh re-import. The source rewrite itself lives in the host (it owns the generated artifact text + the read/confirm/write loop and the @generated guard), so the overlay emits the edit through this sink rather than touching files.
Carries the dragged view's stable anchor id (child_anchor) and the new parent's stable anchor id (new_parent_anchor). The host should call pulp::view::reparent_in_source() against its held generated source. Both anchors are guaranteed non-empty when the sink fires (the overlay only emits for anchored views). Undo re-emits the edit with the ORIGINAL parent, so the host re-derives the inverse rewrite — the engine's idempotent already_current path keeps repeated emits safe.
insert_after_anchor carries the requested insertion slot: the anchor of the sibling the dragged node should follow under the new parent, or EMPTY to land as the parent's first child. Without it the source rewrite always dropped the node as the first child, losing the drop position the user dragged to. Empty is the well-defined "first child" sentinel (an empty anchor never resolves to a real sibling).
| std::string pulp::inspect::InspectorOverlay::ReparentSourceEdit::child_anchor |
| std::string pulp::inspect::InspectorOverlay::ReparentSourceEdit::insert_after_anchor |
| std::string pulp::inspect::InspectorOverlay::ReparentSourceEdit::new_parent_anchor |