Skip to content

feat: add min-length filter and history deduplication#6

Open
dupenodi wants to merge 1 commit into
samirpatil2000:mainfrom
dupenodi:feat/issue-4-min-length-filter-and-deduplication
Open

feat: add min-length filter and history deduplication#6
dupenodi wants to merge 1 commit into
samirpatil2000:mainfrom
dupenodi:feat/issue-4-min-length-filter-and-deduplication

Conversation

@dupenodi

Copy link
Copy Markdown
Contributor

Closes #4

Summary

Addresses noise in clipboard history caused by modal editors (Vim, Emacs) that yank individual characters or repeated fragments on incremental deletions. Two new opt-in settings are added under Preferences → History:

  • Min-length filter — entries shorter than the configured threshold (default: 1 character, range 1–20) are silently dropped before being written to history.
  • Deduplicate history — when enabled, copying a text entry that already exists in history promotes the existing item to the top instead of inserting a duplicate. (Applies to inline text < 50 KB; large file-backed entries are already deduplicated consecutively via hash in ClipboardWatcher.)

Both settings persist via UserDefaults through SettingsManager.

Changes

File What changed
Services/SettingsManager.swift Add minTextLength and deduplicateHistory properties + persistence
Services/ClipboardWatcher.swift Drop entries shorter than minTextLength before adding to store
Services/ClipboardStore.swift In performAdd, promote duplicate inline text to top when dedup is on
Views/SettingsView.swift New "History" section with a Stepper and a Toggle; frame height bumped to 400

Test plan

  • Set min-length to 3 in Preferences; copy a single character — it should not appear in history
  • Copy a word that already exists in history with dedup enabled — existing entry should move to top, no duplicate added
  • Disable dedup; copy the same word twice — both entries should appear
  • Verify settings survive an app restart
  • Verify existing history and bookmarks are unaffected

🤖 Generated with Claude Code

Add two configurable history filters to address noise from modal editors:

- Minimum text length: entries shorter than the threshold (default: 1,
  configurable 1–20) are silently dropped before being written to history.
- Deduplication: when enabled, copying an identical inline text entry
  promotes the existing item to the top instead of inserting a duplicate.

Both settings are exposed in a new "History" section in Preferences and
persisted via UserDefaults through SettingsManager.

Co-Authored-By: Claude Sonnet 4.6 <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.

Feature Request: Minimum text length filter & deduplication for history

1 participant