Skip to main content

handle_layout_stack_move

Function handle_layout_stack_move 

Source
pub(super) fn handle_layout_stack_move(
    state: &mut State,
    tab_id: String,
    block_id: String,
    target_block_id: String,
    position: StackMovePosition,
    activate: bool,
    correlation_id: String,
) -> Vec<Event>
Expand description

Reorder block_id within its own pane, or move it into a different pane — a same-leaf reorder never changes which member is visible unless activate is set. Refuses (an Error event, tree untouched) when either block doesn’t exist in the tab’s tree.

Moving a pane’s ONLY tab into another pane empties it, and the emptied pane is removed (move_stack_member). That one case can leave focus or magnify pointing at a node that’s gone, so instead of the tree-only LayoutTreeReplaced it’s reported exactly like a node delete: focus and magnify reconciled, and a LayoutNodeDeleted for the source leaf that carries the full resulting tree (the tab’s new member included). No block is deleted either way — the moved block lives on in its new pane. SPEC_PANE_TAB_DRAG_AND_DROP_2026_09_19.md §4.1, SPEC_PANE_TAB_DRAG_LANDING_FLASH_AND_LAST_TAB_CLOSE_2026_09_24.md §4.3.