3 Commits
Author SHA1 Message Date
TZGyn 8328e8131d Clear moved items from the selection
Move To only cleared the selection when more than one item moved, so a
single moved item stayed selected — invisible — in the target workspace.
Moved items are now always removed from the selection.
2026-10-28 22:12:42 +08:00
TZGyn 6661f41deb Add Copy & Delete to the selection bar
Scissors icon next to the copy actions; a single item copies as-is (image
included), a multi-selection copies as plain lines, then everything selected
is deleted.
2026-10-27 21:36:28 +08:00
TZGyn 9907db373c Add Copy & Delete to the context menu
Copies the item (or the selection, as plain lines) and removes it in one
step — the 'take this out' gesture. No shortcut: Cmd+X belongs to the text
fields, and a panel binding would steal it.
2026-10-27 21:31:30 +08:00
2 changed files with 47 additions and 3 deletions
+3 -2
View File
@@ -58,9 +58,10 @@ clicking an item copies it back to the clipboard.
There is no in-header close button: the window's own close button hides the There is no in-header close button: the window's own close button hides the
panel. Composer `# Name` creates/ panel. Composer `# Name` creates/
switches sections. Click = select (Shift+click for a range); the selection switches sections. Click = select (Shift+click for a range); the selection
bar offers Copy (single item), Copy as List, Copy as Lines and Delete; bar offers Copy (single item), Copy as List, Copy as Lines, Copy & Delete
(scissors icon) and Delete;
right-click = context menu acting on the whole selection (Copy, Copy as List, 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 Copy as Lines, Copy & Delete, Done, Edit, Open, Merge, Move To, Delete). Esc clears the
selection before it hides the panel. Selection is scoped to the current view: selection before it hides the panel. Selection is scoped to the current view:
switching workspace, switching tab, or closing search clears it. Drop target for images/files. switching workspace, switching tab, or closing search clears it. Drop target for images/files.
- `Sources/Prompt/PanelController.swift` — owns the floating `NSPanel` - `Sources/Prompt/PanelController.swift` — owns the floating `NSPanel`
+44 -1
View File
@@ -324,6 +324,9 @@ struct PanelView: View {
store.copyAsLines(ids: ids) store.copyAsLines(ids: ids)
flashCopied(item.id) flashCopied(item.id)
} }
Button(multiple ? "Copy & Delete \(ids.count) Items" : "Copy & Delete") {
copyAndDelete(item)
}
Divider() Divider()
Button(item.done ? "Mark as Not Done" : "Mark as Done") { Button(item.done ? "Mark as Not Done" : "Mark as Done") {
store.setDone(!item.done, ids: ids) store.setDone(!item.done, ids: ids)
@@ -351,7 +354,11 @@ struct PanelView: View {
ForEach(store.sections.filter { $0.id != store.sectionID(of: item.id) }) { section in ForEach(store.sections.filter { $0.id != store.sectionID(of: item.id) }) { section in
Button(section.name) { Button(section.name) {
store.move(ids: ids, to: section.id) store.move(ids: ids, to: section.id)
if multiple { clearSelection() } // Moved items leave the current view, so they must
// leave the selection too — otherwise they stay
// selected, invisible, in the target workspace.
selection.subtract(ids)
lastSelectedID = nil
} }
} }
} }
@@ -702,6 +709,12 @@ struct PanelView: View {
.font(.caption) .font(.caption)
.buttonStyle(.plain) .buttonStyle(.plain)
.foregroundStyle(Color.accentColor) .foregroundStyle(Color.accentColor)
Button { copyAndDeleteSelection() } label: {
Image(systemName: "scissors")
}
.buttonStyle(.plain)
.foregroundStyle(Color.accentColor)
.help("Copy & Delete")
Button { deleteSelection() } label: { Button { deleteSelection() } label: {
Image(systemName: "trash") Image(systemName: "trash")
} }
@@ -726,6 +739,20 @@ struct PanelView: View {
clearSelection() clearSelection()
} }
/// Same as the context menu's Copy & Delete, for the selection bar. A
/// single image still copies as an image; a multi-selection copies as
/// plain lines, same as Copy as Lines.
private func copyAndDeleteSelection() {
guard !selection.isEmpty else { return }
if selection.count == 1, let id = selection.first, let item = store.item(id) {
store.copy(item)
} else {
store.copyAsLines(ids: selection)
}
store.delete(ids: selection)
clearSelection()
}
private func copySelection(asList: Bool) { private func copySelection(asList: Bool) {
guard !selection.isEmpty else { return } guard !selection.isEmpty else { return }
if asList { if asList {
@@ -855,6 +882,22 @@ struct PanelView: View {
flashCopied(item.id) flashCopied(item.id)
} }
/// One gesture for "take this out": copy, then delete. A multi-selection
/// is copied as plain lines, same as Copy as Lines. No shortcut — Cmd+X
/// belongs to the composer/editor text fields, and a panel binding would
/// steal Cut from them.
private func copyAndDelete(_ item: PromptItem) {
let ids = effectiveIDs(for: item)
if ids.count > 1 {
store.copyAsLines(ids: ids)
} else {
store.copy(item)
}
store.delete(ids: ids)
selection.subtract(ids)
lastSelectedID = nil
}
private func flashCopied(_ id: UUID) { private func flashCopied(_ id: UUID) {
withAnimation { copiedID = id } withAnimation { copiedID = id }
DispatchQueue.main.asyncAfter(deadline: .now() + 1.2) { DispatchQueue.main.asyncAfter(deadline: .now() + 1.2) {