Make the row checkbox select items instead of ticking them off

The checkbox was marking items done, but the intent was to gather items
and act on them: tick several, then right-click to copy, copy as a list,
move, merge or delete them all at once. Done is still available from the
same menu, it is just no longer what the checkbox does.
This commit is contained in:
2026-10-09 17:54:54 +08:00
parent 9f0c0f8113
commit c7b4ed32f2
4 changed files with 96 additions and 44 deletions
+13 -7
View File
@@ -27,13 +27,17 @@ clicking an item copies it back to the clipboard.
`Images/` next to it, cached in an `NSCache`. Owns all mutations (add,
toggle done, edit, delete, move, merge, clear done) and clipboard writes
(`copy`, `copyAsList` for numbered output, `copyAsLines` for plain newlines;
both text modes skip image items). Saves on every mutation.
both text modes skip image items). Batch mutations (`delete(ids:)`,
`setDone(_:ids:)`, `move(ids:to:)`) back the selection context menu, so one
action applies to every selected item and image files are cleaned up once.
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; 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 (Copy, Copy as List, Copy as Lines, Done, Edit,
Open, Merge, Move To, Delete). Esc clears the selection before it hides the
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.
- `Sources/Prompt/PanelController.swift` — owns the floating `NSPanel`
(`.nonactivatingPanel`, `.floating`, right-edge docked, frame autosaved as
@@ -169,8 +173,10 @@ brew upgrade --cask prompt
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
ticking items off, and nested buttons never receive clicks. The row uses
`contentShape` + `onTapGesture` for click-to-copy instead.
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:)`.
- **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