Skip to main content

queue_target_layout_split

Function queue_target_layout_split 

Source
pub(super) async fn queue_target_layout_split(
    state: &AppState,
    target_tab_id: &str,
    block_id: &str,
    target_block_id: &str,
    dir: u8,
) -> Result<(), String>
Expand description

Phase 4b/4c — enqueue a directional split action on the TARGET tab’s LayoutState.pendingbackendactions so the redocked block lands in the exact slot the ghost overlay previewed.

dir maps the DropDirection enum values to action types:

  • 0/4 (Top/OuterTop) → SplitVertical, position before
  • 2/6 (Bottom/OuterBot) → SplitVertical, position after
  • 3/7 (Left/OuterLeft) → SplitHorizontal, position before
  • 1/5 (Right/OuterRight)→ SplitHorizontal, position after
  • 8 (Center) → falls through to InsertNode (handled by caller)

Phase 4c: rather than an absolute nodesize guess (which was only correct when the target happened to be at DefaultNodeSize), this sends nodesizefraction — the new node’s share of the target’s CURRENT size — which the frontend applies against the target’s live size at split time (layoutTree.ts). Inner directions use 0.5 (50/50, matching the ghost’s half-leaf); outer directions use 0.2 (matching the ghost’s exact leaf/5 band — see ANALYSIS_FLOATING_PANE_GHOST_LANDING_DISCONNECT_2026_07_04.md).