Skip to content

Add a quick content-type filter to the Paste Bar - #115

Open
maximdx wants to merge 3 commits into
momenbasel:mainfrom
maximdx:feature/clip-type-filter
Open

maximdx wants to merge 3 commits into
momenbasel:mainfrom
maximdx:feature/clip-type-filter

Conversation

@maximdx

@maximdx maximdx commented Nov 8, 2026

Copy link
Copy Markdown

Closes #114

Summary

The Paste Bar could only be narrowed by pinboard source and free-text search — image clips have no searchable text, and typing "image"/"file" does not filter by kind. This adds a always-visible, one-click content-type filter row directly under the bar's top chrome.

Changes

  • New ClipFilter helper (Sources/Pesty/Store/ClipFilter.swift): pure filtering (type before search, trimmed/lowercased query), per-type counts, available types, and keyboard-cycle rules. Unit-tested; it never touches the store singleton.
  • ClipboardStore: adds typeFilter: ClipType?, sourceItems, typeCounts, availableTypes; visibleItems now composes source → type → search. Changing the filter clears multi-select and selects the first visible clip; addCaptured no longer selects a clip the active filter hides; the filter resets in prepareForBarPresentation(); adds cycleTypeFilter().
  • New ClipTypeFilterBar (Sources/Pesty/UI/ClipTypeFilterBar.swift): horizontal chip row under the top chrome with All Types + the six ClipType cases. Selected chips use the bar's established white-pill style plus the type's accent for icon/border (not as a fill, for contrast); types absent from the current collection are disabled; the selected chip stays enabled so a stranded filter can be tapped off.
  • BarView: inserts the chip row between the top chrome and the strip, updates the empty state to cover empty collection / filter-only / search-only / filter+search, and adds a "Clear Type Filter" recovery action. The overflow menu gains "Cycle Type Filter".
  • AppController: ⌘⇧F cycles the filter; Escape now clears multi-select → search → filter → hide in both keyboard paths.
  • Geometry: bar minimum height 300 → 330 pt (the new row would otherwise squeeze compact File cards), and the Settings slider now derives its range from BarResizeGeometry constants instead of hard-coded 300...720.
  • Docs/tests: 13 new ClipFilterTests; README feature bullet + shortcut table, CHANGELOG "Unreleased" section, and docs/llms.txt updated.

Testing

  • swift build --build-tests — passes, no new warnings.
  • swift test — 20 tests, 0 failures (13 new filter tests + 7 existing).
  • Manually verified in a debug build: chip selection/disabled states, composition with search and pinboards, quick-paste numbering following the filtered list, and the empty-state recovery.

Notes

  • This filters by the existing content-type buckets (ClipType), not by file extension or UTI. Image means copied image data; a Finder-copied image file is recorded as File (called out in the Image tooltip, README, and the issue).
  • The filter lives for one presentation of the bar and resets when it reopens, matching the search-query contract.

- Add a filter chip row under the bar's top chrome: All Types, Text,
  Rich Text, Link, Image, File, and Color.
- Compose type filtering with the pinboard source and text search; quick-paste
  numbers follow the filtered list.
- Reset the filter on every presentation; Escape clears selection, then search,
  then the filter, then closes the bar.
- Add Command-Shift-F cycling and a "Cycle Type Filter" overflow-menu item.
- Raise the bar's minimum height to 330 pt and derive the Settings slider range
  from BarResizeGeometry instead of hard-coded values.
- Add ClipFilter unit tests; update README, CHANGELOG, and docs/llms.txt.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-08T13:14:46.010533Z 1a69e69 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1acd6048f0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Changing the content-type filter clears the multi-selection and selects the
first visible clip, but `clearMultiSelection()` had already stored the
pre-filter selection as the range anchor. Shifting the anchor left range
selection extending from the old clip, which could bulk-delete an unintended
clip (PR momenbasel#115 review). Anchor on the newly selected clip instead.
@maximdx

maximdx commented Nov 8, 2026

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: df7ace4732

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Under an active content-type filter or search query, a newly captured clip
was never selected, which is right while the user still has a visible
selection. But when the narrowed list had no selection left - for example the
last Image clip was deleted while filtering Image, then a new image was copied
without reopening the bar - the strip showed cards with nothing selected, so
Return and Command-C silently did nothing.

Keep an existing visible selection, but let a capture that matches the active
narrowing reclaim the selection when there is none (PR momenbasel#115 review).
@maximdx

maximdx commented Nov 8, 2026

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 1a69e69608

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@maximdx

maximdx commented Nov 8, 2026

Copy link
Copy Markdown
Author

@momenbasel could you take a look when you have a moment?

Codex's automated review is clean on the latest commit (1a69e69); the two P2 findings it raised earlier were addressed in df7ace4 and 1a69e69. swift build --build-tests and swift test pass (20/20), and the PR is mergeable.

This implements the quick content-type filter requested in #114: a chip row under the bar's top chrome (All Types + Text / Rich Text / Link / Image / File / Color), composed with search and pinboards, plus ⌘⇧F cycling, Esc ordering, accessible chips, and a 330 pt minimum bar height so compact layouts keep working.

Happy to rework the layout or keyboard behavior if you'd prefer a different approach.

This branch has not been deployed

No deployments
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.

Feature: quick content-type filter in the Paste Bar

1 participant