Select items by clicking the card instead of copying them

Copying was a side effect of a click, which made it impossible to build
a selection with the mouse and surprising when the intent was to pick
something up rather than copy it immediately. A click now selects (or
deselects), and copying is an explicit action from the selection bar or
the right-click menu.
This commit is contained in:
2026-10-09 17:58:38 +08:00
parent c7b4ed32f2
commit 6580a79d40
3 changed files with 32 additions and 29 deletions
+12 -11
View File
@@ -33,12 +33,11 @@ clicking an item copies it back to the clipboard.
Saves on every mutation.
- `Sources/Prompt/PanelView.swift` — the panel UI. Header (section switcher,
search, add photos, close), item list, composer. Composer `# Name` creates/
switches sections. Click = copy; the row checkbox selects, Cmd+click toggles
multi-select, Shift+click selects a range, and a selection bar offers Copy as
List / Copy as Lines; right-click = context menu acting on the selection
(Copy, Copy as List, Copy as Lines, Done, Edit, Open, Merge, Move To,
Delete). Esc clears the selection before it hides the
panel. Drop target for images/files.
switches sections. Click = select (Shift+click for a range); the selection
bar offers Copy (single item), Copy as List and Copy as Lines; right-click =
context menu acting on the whole selection (Copy, Copy as List, Copy as
Lines, Done, Edit, Open, Merge, Move To, Delete). Esc clears the selection
before it hides the panel. Drop target for images/files.
- `Sources/Prompt/PanelController.swift` — owns the floating `NSPanel`
(`.nonactivatingPanel`, `.floating`, right-edge docked, frame autosaved as
`PromptPanel`), the Cmd+V image-paste monitor, and `EditWindowController`
@@ -172,11 +171,13 @@ brew upgrade --cask prompt
dispatches `paste:` to the responder chain itself for text, and adds the
clipboard image to the store when there is no text. `Prompt --diag` dumps the
menu so the wiring can be checked without a keyboard.
- **A row is not a `Button`** because it contains a checkbox `Button` for
selecting the item, and nested buttons never receive clicks. The row uses
`contentShape` + `onTapGesture` for click-to-copy instead. Selection is
driven by the checkbox, Cmd+click (toggle) and Shift+click (range); the
context menu acts on the whole selection via `effectiveIDs(for:)`.
- **A row is not a `Button`** because it contains a checkbox `Button`, and
nested buttons never receive clicks. The row uses `contentShape` +
`onTapGesture` so a click anywhere on the card selects it. Selection is
driven by the card click, the checkbox, Cmd+click (toggle) and Shift+click
(range); the context menu acts on the whole selection via `effectiveIDs(for:)`.
Copying is an explicit action (selection bar or context menu), never a side
effect of a click — that was changed deliberately.
- **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