Skip to content

feat: drag-and-drop reordering for editor file tabs#86

Merged
nwparker merged 1 commit intomainfrom
nwparker/drag-and-drop-tabs-more
Mar 25, 2026
Merged

feat: drag-and-drop reordering for editor file tabs#86
nwparker merged 1 commit intomainfrom
nwparker/drag-and-drop-tabs-more

Conversation

@nwparker
Copy link
Copy Markdown
Contributor

Summary

  • Enables drag-and-drop reordering for editor file tabs (open files, diffs), matching the existing terminal tab behavior
  • Uses the same @dnd-kit/sortable library already used for terminal tabs
  • Tabs can only be reordered within their own group (terminal tabs with terminal tabs, editor tabs with editor tabs)

Changes

  • EditorFileTab: Added useSortable hook with drag transform/opacity, replaced onClick with onPointerDown for proper dnd-kit integration
  • TabBar: Extended SortableContext to include both terminal and editor file IDs, updated handleDragEnd to detect which group is being reordered
  • Editor store: Added reorderFiles action that reorders files in-place while preserving other-worktree file positions
  • Terminal: Wired up reorderFiles store action to TabBar

Test plan

  • Open multiple editor file tabs and verify they can be dragged to reorder
  • Verify terminal tabs can still be dragged to reorder
  • Verify dragging a terminal tab onto an editor tab (or vice versa) does nothing
  • Verify middle-click to close still works on editor tabs

🤖 Generated with Claude Code

Enable seamless reordering of all tabs (terminal and editor) via drag-and-drop
in a single unified tab bar. Terminal and editor tabs can be freely mixed and
reordered together.

**Changes:**
- Added tabBarOrderByWorktree + setTabBarOrder to terminal slice for unified
  visual tab ordering
- Rewrote TabBar component to use single DndContext with all tab types in one
  SortableContext (instead of isolated groups)
- TabBar reconciles stored order with current items (handles tab addition/deletion)
- Keyboard shortcuts (Cmd+Shift+]/[) now respect custom tab order
- Updated editor tab context menu: removed "Copy Path to Line" options,
  replaced "Close Others" with "Close Tabs To The Right" to match terminal menu
- "Close Tabs To The Right" now closes both terminal and editor tabs to the right
  in unified tab order
- Terminal tab sortOrder stays in sync with visual order for session persistence

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@nwparker nwparker force-pushed the nwparker/drag-and-drop-tabs-more branch from 1e27c75 to 3af8557 Compare March 25, 2026 00:52
@nwparker nwparker merged commit 556f31a into main Mar 25, 2026
@nwparker nwparker deleted the nwparker/drag-and-drop-tabs-more branch March 25, 2026 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant