Move workspace file work off the main thread and delete to the trash

Run the blocking workspace commands on the blocking thread pool.
Tauri runs a synchronous command on the main thread, so a long search
or copy froze every window. Command names, arguments, and results do
not change.

Send each workspace-event only to the windows that have its root open.
The frontend listens with its window label as the target. Do not send
access events, because the frontend ignores them. Drop watchers after
the state lock is released, because a macOS watcher waits for its
thread when it stops.

Fix these defects. Each fix has a Rust test:
- A rename that changes only the letter case works on case-insensitive
  volumes.
- New files publish with a move that never replaces a file: MoveFileExW
  on Windows, renameat2 or renamex_np on Linux and macOS, then a hard
  link, then create_new. exFAT, FAT32, and many network mounts now work.
  The Windows save recovery uses the same move.
- On macOS and Linux, existing names with a colon stay usable. New names
  reject the characters that Windows does not allow, on every platform.
- workspace_read_data_url checks the size before it reads the file.
- workspace_write_bytes uses the atomic writer. Its only caller writes
  new names, so it gets no conflict check.
- Delete and rename act on a link itself, not on its target.

Delete now moves items to the system trash. One file moves without a
confirmation. A folder or several items need one. Shift+Delete and
"Delete permanently" keep the permanent delete with its confirmation.
Windows drives without a Recycle Bin give an error instead of a silent
permanent delete. The smoke test for tree actions now checks this
behavior. The user guide describes it and the new-name rule.
This commit is contained in:
Knotty Wyvern
2026-10-27 23:15:14 -07:00
parent 2448c68abf
commit a0eef01ed0
9 changed files with 978 additions and 127 deletions
+16 -1
View File
@@ -51,7 +51,21 @@ Right-click a file or folder for more actions, such as **Make a copy**, **Copy w
With the navigator focused, Ctrl+X, Ctrl+C, and Ctrl+V cut, copy, and paste files.
Ctrl+Z undoes a file move or rename, and Ctrl+Shift+Z or Ctrl+Y repeats it.
**Delete** removes files permanently. It does not use the Recycle Bin or Trash, and Ctrl+Z cannot restore the files.
### Delete files
**Delete** moves the selected items to the Recycle Bin or Trash. To get them back, restore them from there. Ctrl+Z does not restore deleted files.
- Select items in the navigator and press Delete, or right-click and choose **Delete**. On macOS, you can also press Cmd+Backspace.
- RuneStone asks for confirmation before it moves a folder or several items. One file moves without a question.
- **Delete permanently** (Shift+Delete, or Cmd+Option+Backspace on macOS) removes the items from the disk. RuneStone always asks first.
- A link is deleted as a link. The file or folder that it points to stays.
Network drives, removable drives, and some Linux setups have no trash. There, **Delete** shows an error and keeps the files. Use **Delete permanently** if you want to remove them.
### Names of new files
A new name cannot contain these characters: `< > : " | ? *`. Windows does not allow them. This rule applies on every platform, so that a workspace that you share, for example through Git, also opens on Windows.
On macOS and Linux, you can still open, edit, rename, and delete existing files whose names contain these characters.
## Edit documents
@@ -197,6 +211,7 @@ This table lists the Windows and Linux keys.
| Switch Writer and IDE | Ctrl+E |
| Show or hide the sidebar | Ctrl+B |
| Rename | F2 |
| Delete to the trash / Delete permanently | Delete / Shift+Delete |
| Context menu | Shift+F10 |
| Settings / Help and about | Ctrl+, / F1 |