Add a right-click context menu to file rows

Renaming, archiving and deleting a file all lived in buttons under the
list, and all of them required selecting the file first. The same
operations are now on the row itself: right-click a file for Rename,
Copy path, Archive and Delete.

The menu records what was picked rather than acting on it, because the
list is drawn inside a closure still borrowing `self` — the same
deferred pattern the click and drag-drop handling already use. Right-
clicking selects the row first, so the menu always acts on the file you
clicked; selecting is a no-op when it is already current, so this cannot
reload the buffer out from under an unsaved edit.

Rename opens a focused dialog with the path pre-filled, and stays open
if the name is rejected so a clash does not cost what was typed;
rename_selected reports success for that. Delete asks first.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GBWj9TphFMCoh7VHaSRnvQ
This commit is contained in:
landon
2026-09-07 11:57:49 -05:00
parent 70046b0382
commit aa050cf411
4 changed files with 262 additions and 7 deletions
+8
View File
@@ -221,6 +221,14 @@ and give a chapter its own folder of scenes — nesting goes eight levels deep.
file just as dragging does.
* ** New from template** puts its `untitled-N.md` in the folder of the file you
are editing, so working inside a part doesn't scatter new files at the top.
* **Right-click a file** for a menu of the things you can do to it:
**📝 Rename…**, **⧉ Copy path**, **🗄 Archive** and **🗑 Delete…**. It acts on
the file you clicked — right-clicking selects it first — so you do not have to
select a file before reaching for the operation. Rename opens a small dialog
with the path already filled in and the box focused; it stays open if the name
is rejected, so a clash never costs you what you typed. Delete asks first.
These are the same operations as the buttons under the list, which stay where
they are.
Folders are skipped when they cannot hold manuscript prose: anything starting
with a `.` (so `.git` is never walked), plus `target/` and `node_modules/`.