uttrflow / uttrflow/uttrflow-swift

Choosing a picture clip when the panel can only copy, or pressing its Copy, empties the clipboard and says "Copied"

Open
#580 0 comments 0 reactions 0 assignees View on GitHub
area:clipboard bug P1
Dominant language
Swift
Stars
4
Forks
17
Avg merge
3h 32m
Merged PRs (30d)
277

Description

## What happens

A picture clip's `text` is `""`: the picture lives in a file (`PasteboardWatcher.swift:111-115`). Three paths treat it as text anyway.

1. **Return while the panel can only copy.** This happens when Accessibility is not granted, nothing is focused, or Uttrflow is in front. `resolving` returns `.copyOnly(clip, obstacle)` for any clip (`Sources/UttrflowUX/PanelKeyboard.swift:181-182`). `PanelOutcome.effect` turns that into `.copyAndSay(clip.text, …)` (`Sources/UttrflowUX/PanelEffect.swift:37`), and `AppDelegate` writes `""` with `announcingPasteboard.setText` (`AppDelegate.swift:856-861`, `:1099-1103`). `SystemPasteboard.setText` clears the pasteboard first (`Sources/UttrflowInput/SystemInput.swift:34-39`). What the user had copied is gone, and the panel says "Copied — press ⌘V".
2. **The row's Copy action.** It is offered on picture rows (`PanelPresentation.swift:436`) and calls `putOnClipboard(clip.text, …)` (`AppDelegate.swift:956-960`): the same empty write, and the panel closes.
3. **⌘Return on a picture.** `resolvingPlain` has no picture case (`PanelKeyboard.swift:187-195`), so the effect is `closeAndInsert("")`. It also skips the missing-picture check that `resolving` does.

"Make a note" is also offered on picture rows (`PanelPresentation.swift:459-464`) and would promote the empty text.

## Reproduced headlessly

```text
picture clip, insertion .clipboardOnly(.accessibilityNotGranted), .return
-> copyAndSay("", "Copied — press ⌘V. Turn on Accessibility and Uttrflow can paste for you.")
picture clip, insertion .atCaret, .returnPlain
-> closeAndInsert("")
row actions -> ["Insert", "Copy", "Pin", "Name", "Move", "Make a note", "Delete"]
```

## Why it matters

A user who has not granted Accessibility, which is the first-run state, picks a screenshot. They lose whatever was on their clipboard and are told the picture was copied. Pressing ⌘V pastes nothing.

## Acceptance criteria

- In copy-only mode, a picture clip puts its PNG on the clipboard through the announcing pasteboard's `setImage`. A missing file gives the existing "no longer on this Mac" notice.
- Copy on a picture row copies the picture.
- ⌘Return on a picture behaves like Return, including the missing-picture check.
- "Make a note" is not offered on picture rows.
- Tests in `Tests/UttrflowUXTests` cover all four, and a test asserts that no panel effect for a picture clip carries an empty string to the clipboard.

Contributor guide

Open the contributing guide

Research direction

Start with the paths cited in Sources/UttrflowUX/PanelKeyboard.swift, PanelEffect.swift, PanelPresentation.swift, AppDelegate.swift, SystemInput.swift, and PasteboardWatcher.swift, then run the existing Tests/UttrflowUXTests suite. Trace picture clips through Return, ⌘Return, row Copy, and Make a note, including the existing missing-file behavior. Done means all four acceptance cases work and tests show no picture effect sends an empty clipboard string.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, swift
Domain
accessibility, desktop, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.