Skip to content

feat(terminal): drag & drop reorder for terminal slots#18

Merged
iptoux merged 3 commits into
mainfrom
feat/terminal-titlebar-drag-drop
May 22, 2026
Merged

feat(terminal): drag & drop reorder for terminal slots#18
iptoux merged 3 commits into
mainfrom
feat/terminal-titlebar-drag-drop

Conversation

@iptoux
Copy link
Copy Markdown
Contributor

@iptoux iptoux commented May 22, 2026

Summary

  • A drag handle (LuGripVertical) in every terminal titlebar lets you reorder entire slots (including split panes and agent labels) by dropping them on another slot in the same workspace grid.
  • Reorder is a pure Vec permutation across slot_ids / slot_agent_labels / slot_pane_states → PTYs and xterm sessions are preserved (For key is slot.id, terminal_key stays stable).
  • Drag state lives in TerminalSlotDragService (Leptos context); source and target are resolved live by slot_id against the workspace state (new WorkbenchService::terminal_slot_index), so repeated reorders compose without stale array indices.

Out of scope (V1)

  • Cross-workspace transfer
  • Dragging individual split panes out of a slot
  • Custom HTML5 setDragImage (crashes WebKitGTK / Wry with both live and cloned DOM)

Implementation notes

  • New module src/workbench/terminal_slot_dnd.rs — MIME application/x-blxcode-terminal-slot, payload helpers, drag service (non-reactive StoredValue<bool> session + generation guard against stale deferred updates), ghost-style helper.
  • State (src/workbench/state.rs) — reorder_terminal_slots(workspace_id, from, to) + pure-Rust reorder_workspace_slots, plus terminal_slot_index.
  • UI
    • src/workbench/terminal_cell.rs — grip handle on each slot, deferred try_set_active(gen, meta) so Leptos doesn't re-render mid-dragstart (which would otherwise cancel the drag on WebKitGTK).
    • src/workbench/workspace_panel.rsdragover / drop handlers on the ws-term-slot wrapper, ghost overlay at the target cell, ws-term-grid--drag-active disables pointer events on foreign xterm canvases while a drag is in flight.
  • CSS (styles.css) — .ws-term-cell__drag-handle, .ws-term-slot--drag-source (opacity 0.55), .ws-term-slot--drag-over (3px dashed outline), .ws-term-slot-ghost (2px dashed border, transluscent).
  • i18n — new key WsTermDragHandleAria authored in all 13 locales.
  • Testsstate::terminal_slot_tests (3 unit tests: parallel permutation, no-op on from == to, swap first slot).
  • Docs — new section "Reordering terminals with drag & drop" in docs/user/workspaces.md; entry under [Unreleased] / Added in CHANGELOG.md.

Disabled states

  • Workspace configurator is open
  • Slot is in full-size mode
  • Sidebar is collapsed

Test plan

  • cargo check -p blxcode-ui --target wasm32-unknown-unknown clean
  • cargo test -p blxcode-ui terminal_slot — 3/3 passing
  • Manual (cargo tauri dev): 4 terminals running sleep 999 each → repeated reorders in both directions, PTY output keeps flowing, agent labels travel with the slot
  • Manual: full-size slot → handle hidden, drag refused
  • Manual: configurator open → no drag feedback
  • Manual: reload after reorder → order persists

iptoux added 3 commits May 22, 2026 23:40
Added styles and internationalization keys for drag-and-drop interactions within terminal slots. Introduced new methods for reordering terminal slots and growing the workspace grid to accommodate additional slots. Enhanced user experience by allowing users to drag and drop terminal slots, with visual feedback during the drag operation. Updated multiple locale files to support new drag-and-drop features across 13 languages.
…nal slot management

Updated styles for drag-and-drop interactions, replacing box-shadow with an outline for better visibility. Introduced a new method to retrieve the live index of terminal slots in the workspace grid, improving the drag-and-drop experience. Refactored drag session management to prevent stale UI updates and ensure accurate slot reordering during drag operations.
Added functionality to reorder terminal slots using a drag-and-drop interface, allowing users to swap positions of slots within the same workspace grid. Introduced visual feedback during the drag operation, including opacity changes and outlines for better user experience. Updated documentation to reflect the new drag-and-drop feature and its usage, along with internationalization support for new UI elements across 13 locales.
@iptoux iptoux added enhancement New feature or request review Ticket/Steps need to be review/tested labels May 22, 2026
@iptoux iptoux merged commit 51850d2 into main May 22, 2026
1 check passed
@iptoux iptoux deleted the feat/terminal-titlebar-drag-drop branch May 22, 2026 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request review Ticket/Steps need to be review/tested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant