Skip to content

Preserve text formatting (RTF/HTML) when pasting older clippings#4

Open
MiMoHo wants to merge 1 commit into
haad:masterfrom
MiMoHo:preserve-text-formatting
Open

Preserve text formatting (RTF/HTML) when pasting older clippings#4
MiMoHo wants to merge 1 commit into
haad:masterfrom
MiMoHo:preserve-text-formatting

Conversation

@MiMoHo

@MiMoHo MiMoHo commented Jul 3, 2026

Copy link
Copy Markdown

Summary

Flycut has always stored and pasted plain text only — pasting any clipping through the bezel, menu, or search window strips all formatting. This adds formatting preservation:

  • On capture, the RTF and HTML representations of a text clipping are read (if present) and stored alongside the plain text
  • On paste, the rich types are declared in addition to the plain string — rich text editors keep bold, fonts, links, and colors; plain-text targets are completely unaffected
  • Works for the bezel, the menu, and the search window paste paths
  • Rich data persists through the existing NSUserDefaults store and survives restarts

Design / privacy considerations

  • Rich data is only captured after the existing shouldSkip: checks pass, so concealed/transient clippings (password managers) never have their rich representations read
  • Capped at 1 MB per representation so a giant styled clipping can't bloat the store; RTFD (embedded images) is deliberately not captured
  • Loading validates the shape of persisted rich data (string keys → NSData values) before restoring it, so a corrupted plist can't inject unexpected types
  • New preserveTextFormatting default (ON), documented in help.md, opt-out via defaults write com.generalarcade.flycut preserveTextFormatting -bool NO — happy to wire a preferences checkbox if you'd like one in the panel
  • Display strings, search, and dedup still operate on the plain text, so behavior there is unchanged

Testing

All changed files pass clang -fsyntax-only against the macOS SDK with no new diagnostics versus master. I could not run a full xcodebuild locally (no full Xcode on this machine), so please give it a CI build/manual smoke test: copy styled text from e.g. Safari or TextEdit, copy something else, then paste the older clipping into TextEdit (formatting kept) and into a terminal (plain text as before).

🤖 Generated with Claude Code

Flycut previously stored and pasted plain text only, so pasting any
clipping through the bezel, menu, or search window stripped all
formatting. Capture now also reads the RTF and HTML representations of
text clippings (after the concealed/transient skip checks, capped at
1 MB per type) and stores them alongside the plain text. Pasting
declares the rich types in addition to the plain string, so rich text
editors keep bold, fonts, links, and colors while plain-text targets
are unaffected.

Rich data persists through the existing NSUserDefaults store and can be
disabled with the new preserveTextFormatting default (documented in
help.md).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant