Add clipboard_formats: classify + diff the clipboard's available formats#403
Merged
Conversation
The clipboard holds the same content in several formats at once, and nothing reported which formats were present or detected when that set changed. Add classify_format/classify_formats (map standard CF_* ids + registered names to friendly categories), diff_formats (pure monitor primitive returning added/removed/changed), and a Win32 EnumClipboardFormats enumeration. Classifier and diff are pure and headless-tested; only the live enumeration is Win32.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 42 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Why
The clipboard usually holds the same content in several formats at once — a Word copy offers
CF_UNICODETEXT+HTML Format+Rich Text Format, a file copy offersCF_HDROP, a screenshot offersCF_DIB. Nothing reported which formats are present (so an automation could know what it can paste) or detected when that set changed.clipboard_formatsadds:classify_format/classify_formats— map standardCF_*ids and registered format names to friendly categories (text / image / files / html / rtf / csv / audio / …)diff_formats— a pure monitor primitive:{added, removed, changed}between two snapshotslist_clipboard_formats/clipboard_formats— enumerate the live clipboard (EnumClipboardFormats) without consuming anything, and classify itDesign
nametakes priority over the id since registered formats have dynamic ids (>= 0xC000). Descriptors accept an id,{id, name}, or(id, name).smart_waits.wait_until_clipboard_changes(which monitors content) — this reports the format set.RuntimeErrorelsewhere).__all__→AC_clipboard_formats(live) +AC_classify_formats/AC_diff_formats(pure) → read-onlyac_*MCP tools → Script Builder (Data). Qt-free verified.Tests
test/unit_test/headless/test_clipboard_formats_batch.py— standard-id and named classification (name priority), summary categories/flags, diff added/removed/no-change, tuple descriptors, the pure executor paths (_classify_formats/_diff_formats), and 5-layer wiring. 25 passed alongside the clipboard siblings. Win32 enumeration not executed in CI.