feat(files): drag-and-drop rename / move in the Files tree#35
Merged
Conversation
Repo::move_path (git mv for tracked sources, fs rename for untracked; overwrite refused, dest parents created, both ends path-guarded) + repo_move_path IPC + useRepo.moveEntries. PierreTree grows an opt-in pointer-based drag (shadow-root rows cannot be draggable; mouse events compose across the boundary) with a ghost chip, folder-row wash, and Escape cancel; context-menu "Rename / move..." opens RenameFileDialog for keyboard parity. Verified end-to-end over WebView2 CDP.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Repo::move_path(crates/strand-core/src/rename.rs): rename / move a working-tree entry. Tracked sources (any index entry at or under the path) shell out togit mvso the index entry moves with the file — staged content preserved, directory moves and case-only renames handled natively; untracked sources are a plain fs rename. Refuses to overwrite, creates missing destination parent dirs, and guards both ends (safe_workdir_pathfor the source, an ancestor-walking variant for the not-yet-existing destination).repo_move_pathIPC (quick sync write) +useRepo.moveEntries: sequential moves with a single snapshot refresh, per-entry failure strings so one collision does not hide the moves that succeeded; an open file view follows its file to the new path.PierreTreedrag-to-move (opt-inonMove): pointer-based — the rows live in Pierre's shadow root where nothing can be markeddraggable, but mouse events compose across the boundary. All imperative refs + direct DOM so the 60Hz mousemove never re-renders the tree. 5px threshold, cursor-chasing ghost chip naming entry + target (dashed when invalid),--bg-selwash on the hovered folder row, file rows target their containing folder, bare tree space the repo root, Escape cancels, a multi-selected file drags the whole selection.RenameFileDialogbehind the Files-tree context menu ("Rename / move…") for keyboard parity; filename segment preselected.Test plan
cargo test -p strand-core— 96 pass (+5 newrenametests: tracked/untracked/directory moves, overwrite + missing + no-op guards, traversal/absolute rejection)cargo clippy --workspace --all-targets— no new warnings (4 pre-existing incommit.rs/history.rstest code from a newer clippy)tsc --noEmit,vitest run(198 pass),vite buildsrc/(git statusR rootfile.txt -> src/rootfile.txt), an untracked file intodocs/(stays untracked, index untouched), and dialog-renamed a modified file (RMwith the worktree edit preserved); asserted the ghost chip text mid-drag and its removal after drop.🤖 Generated with Claude Code