Skip to content

Consolidate editor-group tab drag-drop onto quadraui drop primitives (full TabGroupController adoption deferred — see quadraui#395) #515

Description

@JDonaghy

Summary

Once quadraui#349 lands (cross-group tab drag-and-drop in TabGroupController), replace vimcode's bespoke editor-group drag model + drop-apply logic with the quadraui controller, deleting the per-backend drag wiring. This brings the feature in line with the platform-neutrality rule in CLAUDE.md — the current arrangement is pre-quadraui tech debt that predates TabGroupController.

Blocked on: JDonaghy/quadraui#349. Do not start until that has landed and ~/src/quadraui is pulled.

Current state (what vimcode owns today)

VimCode implements the entire draggable-editor-group feature itself and reuses quadraui only for the geometry hit-test (quadraui::compute_drop_zone, called once at src/render.rs:12563). The rest is vimcode-side:

Concern Location
Recursive split-tree model — GroupLayout (Leaf/Split), GroupId, DropZone, GroupDivider src/core/window.rs:260–311
Tree mutation — split_at, remove, dividers, calculate_group_rects, ratio math src/core/window.rs:313–669
Drag state + drop-apply — tab_drag_begin, tab_drag_drop, move_tab_to_target_group(_at), move_tab_to_new_split, reorder_tab_in_group, close_group_by_id src/core/engine/windows.rs:2040–2224
Drop-zone adapter (vimcode bounds → quadraui::DropGroupRect, result → DropZone) src/render.rs:12441–12584 (build_tab_drop_groups, compute_tab_drop_zone)
Overlay geometry (highlight / insertion bar / ghost rects) src/render.rs:12586–12655 (compute_tab_drop_overlay)
Per-backend drag wiring — GTK ~74 lines src/gtk/mod.rs:7140–7410, 7545–7551
Per-backend drag wiring — TUI ~38 lines src/tui_main/mouse.rs:874–906, 1086–1092

Goal

Migrate onto quadraui::TabGroupController (post-#349) so that:

  • The recursive split model + drop mutations are deleted from vimcode and provided by quadraui.
  • Per-backend GTK/TUI drag wiring collapses to thin event→controller forwarding (press/move/release → begin_tab_drag / tab_drag_over / end_tab_drag).
  • The vimcode adapters in render.rs (build_tab_drop_groups, compute_tab_drop_zone, compute_tab_drop_overlay) are removed — the controller computes zones and draws its own overlay.

Work

  1. Adopt TabGroupController as the editor-group backing store (replacing editor_groups / group_layout / active_group in Engine, or wrapping it).
  2. Map vimcode's tab content (windows/buffers) onto PaneTab { content: Box<dyn BackendWidget> }.
  3. Forward backend mouse events to the controller's tab-drag lifecycle; delete move_tab_to_*, reorder_tab_in_group, and the DropZone adapter once parity is confirmed.
  4. Remove GroupLayout/DropZone from src/core/window.rs only if nothing else depends on them (window splits inside a group still use WindowLayout — keep that).

Seams that MUST keep working (do not regress)

  • Session persistenceSessionGroupLayout serde tree + flat back-compat fields (open_files_group1, active_group, group_split_direction/ratio) in src/core/engine/buffers.rs:3437–3537. Either keep serializing from the controller's tree or migrate the format with back-compat.
  • Keyboard splits / focusCtrl+\ split right, Ctrl+1Ctrl+9 focus by tree position, Ctrl-W e/E, Alt+,/Alt+. resize (TUI), divider drag (GTK), and the user-configurable panel_keys.split_editor_right/down. These must map onto controller operations.
  • Per-group tab bars and group dividers rendering across both backends.

Acceptance criteria

  • quadraui#349 has landed and ~/src/quadraui pulled (cd ~/src/quadraui && git pull).
  • Feature parity on GTK and TUI: drag a tab into another group (merge), drag a tab out to create a new split group on demand, reorder tabs within a group.
  • Net deletion of vimcode code: per-backend drag wiring and the move_tab_to_* / drop-zone adapters are gone; git diff --stat shows the backend files shrinking.
  • Session save/restore of editor-group layout still works (open splits, reopen, layout preserved) with back-compat for existing session files.
  • Keyboard split/focus/resize bindings still work.
  • cargo test --no-default-features, cargo clippy -- -D warnings, cargo fmt all pass.

Why

Per CLAUDE.md platform-neutrality rule: drag/layout/click logic must live in quadraui or shared render.rs, never as per-backend code. This feature currently violates that with ~112 lines of GTK+TUI-specific drag wiring and a full second copy of the split-tree model. Completing quadraui#349 and migrating here removes the duplication and makes the capability reusable by every quadraui app.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    coordTracked by coord-tui pipelinestatus:readyRefined and ready to enter the work pipeline

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions