handle_move_tab

Function handle_move_tab 

Source
pub(super) fn handle_move_tab(
    state: &mut State,
    tab_id: String,
    src_workspace_id: String,
    dst_workspace_id: String,
    dst_index: u32,
) -> Vec<Event>
Expand description

Phase E.5.5 — move a tab from src_workspace_id to dst_workspace_id, inserting at dst_index (clamped to dst’s length). Updates the tab’s workspace_id, removes it from src’s tab_ids, inserts into dst’s tab_ids. If the tab was src’s active_tab_id, src’s active reverts to its first remaining tab (or None when empty).

Errors when:

  • source / dest workspace not found,
  • tab not found,
  • tab.workspace_id != src_workspace_id (caller-side bug),
  • src_workspace_id == dst_workspace_id (use ReorderTab for intra-workspace reorders — same-workspace moves through this path would create ambiguity around dst_index semantics).