fix(explorer): move open editor tabs when cut and paste moves their file
Merged
GN
2d ago+143+143+012345678901234567890123456789-0-0-0123456789
Summary
- Cut and paste of a file or folder in the explorer moved it on disk but left its open editor tab, buffer and unsaved edits on the old path. Saving the tab then wrote the old path and recreated the file there.
file-explorer-store.pastenow callsmoveOpenEditorTabsafter a successful move, the same helper the rename flow uses since #1308. - The second item in the issue (a save in flight while a file is renamed or moved) is not fixed here. A write already issued to the old path cannot be re-targeted by resolving the path at write time. A real fix makes the rename wait for
savesInFlightin three callers, which is not a small change. This PR usesRefs, so the issue stays open for that item.
Related Issue
Refs #1310
Type of Change
- fix: bug fix
- test: adds or updates tests
What Changed
pasteinsrc/renderer/stores/file-explorer-store.tsmoves open tabs after each successful cut-move.- New
file-explorer-store.paste-move.test.tscovers a dirty file, a folder with nested open files, a failed move and a copy.
How It Was Tested
-
bun run typecheck - Manual verification completed
- Not applicable
Red on origin/dev: the new test fails with expected [ '/project/src/a.ts' ] to deeply equal [ '/project/lib/a.ts' ] (2 failed, 2 passed). With the fix, the new file and the explorer, file-explorer and mobile explorer suites pass (11 files, 239 tests). Drag-and-drop in the tree only opens files in panes and the mobile explorer has no move action, so paste is the only move path.
Screenshots or Recordings
Not a visual change.
CI & Review Gate
- All CI checks pass (PR Validation, Rust Checks, Build Verification, Security Scans)
- Code review comments from CodeRabbit / Claude have been addressed or resolved
- No unresolved review findings remain
Checklist
- My PR title follows the conventional commit format used by this repo
- I linked the related issue or explained why none exists
- I updated docs when needed
- I added or updated tests when needed
- I verified the change does not introduce unrelated modifications
- I read AGENTS.md and followed the contributor guidelines
- A human reviewed the complete diff before submission
Summary by cubic
Fixes explorer cut and paste leaving open editor tabs, buffers, and unsaved edits on the old path. paste now calls moveOpenEditorTabs after a successful cut-move, so saving writes to the new path instead of recreating the file at the old one.
Refs #1310. Partial fix only — a save already in flight when its file moves is not re-targeted.
Summary by CodeRabbit
- Bug Fixes
- Open editor tabs now follow files moved through cut-and-paste.