Restore pasting and rename sections to workspaces

Replacing the main menu dropped the Edit menu that AppKit routes
Cmd+V/C/A/Z through, so the composer could not paste at all. The menu is
rebuilt with those items, which --diag now dumps so the wiring can be
checked without a keyboard.

Workspaces also gained an order: the Cmd+K switcher has up/down controls,
creating one opens a naming modal instead of prefilling the composer, and
the UI now says workspace throughout. The stored JSON keeps the original
`sections` keys so existing data and sync payloads stay valid.
This commit is contained in:
2026-10-09 17:29:16 +08:00
parent c5011d03e7
commit 93cd6f2056
5 changed files with 160 additions and 37 deletions
+8
View File
@@ -156,6 +156,14 @@ brew upgrade --cask prompt
## Gotchas
- **Setting `NSApp.mainMenu` replaces SwiftUI's default menu.** SwiftUI installs
a menu containing the standard Edit items, and AppKit routes Cmd+C/V/X/A/Z
through those items — so a hand-built menu with only Hide/Quit silently
breaks pasting, copying and select-all in the composer. `setupMainMenu()`
therefore rebuilds an Edit menu with `undo:`/`redo:`/`cut:`/`copy:`/`paste:`/
`selectAll:` (nil targets, so they travel the responder chain to the field
editor). `Prompt --diag` dumps the menu so this can be checked without a
keyboard.
- **Never bind bare keys as `.keyboardShortcut` in the panel** (Space, Delete,
plain Cmd+C). SwiftUI key equivalents are matched before text input and
would steal characters from the composer TextField. Only Cmd-modified