Skip to content

Clipboard restore path clears non-text clipboard content #11

@xvvcs

Description

@xvvcs

Problem

When command-pipeline capture fails, restoreClipboard(_:) writes an empty string if the previous clipboard content was not a string (nil). This can erase existing non-text clipboard payloads (images/files/rich content).

Impact

  • Unexpected clipboard data loss for users.
  • Usability regression for workflows relying on non-text clipboard items.

Evidence

  • Previous clipboard read as string only: PromptRefactorApp/PromptRefactorApp/AppRuntimeController.swift:306
  • Restore behavior writing empty string on nil: PromptRefactorApp/PromptRefactorApp/AppRuntimeController.swift:423

Recommendation

  • Preserve full pasteboard state (types/items), not just plain string.
  • If full restoration is not feasible, avoid clearing clipboard when original content is non-string.
  • Add regression tests for non-text clipboard before/after failed capture.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions