Skip to content

Favorites: add and edit pattern favorites, including regexes#60

Merged
Tannex merged 5 commits into
mainfrom
favorites-pattern-editor
Jul 20, 2026
Merged

Favorites: add and edit pattern favorites, including regexes#60
Tannex merged 5 commits into
mainfrom
favorites-pattern-editor

Conversation

@Tannex

@Tannex Tannex commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Closes #56. Stacked on #59; retarget as the chain merges.

Store (internal/favorites): new Add(pattern) and Rename(old, new) — normalized via dsnmap.NormalizePattern (wildcards upper-case, regexes keep their case), validated via dsnmap.ValidatePattern, duplicates rejected, renames preserve note/created/lastUsed.

Popup (internal/compaz/favorites.go): a second text input alongside the note editor —

  • a opens an empty pattern input (placeholder documents the dialect: name, */% wildcards, /regex/),
  • e opens it prefilled with the selected favorite's pattern,
  • enter saves and re-snapshots the store with the saved favorite selected; validation errors show inline and keep the input open; esc closes just the input,
  • printable keys keep reaching whichever input is active (inputActive() feeds the existing FavoritesInput key-context gate, so a/e still type into the note editor).

Regex favorites render with the existing ~ pattern marker and behave like other pattern favorites when applied as a filter.

Verified with store tests (normalization, duplicate/invalid/empty rejection, rename preservation), popup tests (add regex via keystrokes, inline invalid-regex error, edit prefill + note preservation, note-input typing guard), and a demo-mode capture adding /^demo.cust/ through the real key path.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CS2LZMn2YJdebAiry2jzdP

Favorites could only be toggled from the selected data set, so a
favorite always started as an exact DSN even though the store and
matcher already understood wildcard and /regex/ patterns. The popup
now has an add input (a) for new patterns and an edit input (e) that
renames the selected favorite in place, both validated through
dsnmap.ValidatePattern with the error held inline while the input
stays open. The store grows Add and Rename; renames preserve note and
timestamps, duplicates and invalid regexes are rejected.

Closes #56

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CS2LZMn2YJdebAiry2jzdP
Tannex and others added 3 commits July 20, 2026 05:55
selectedLineIndex ignored the add-pattern input line prepended to the
popup content, so long scrolled lists rendered one row off while the
input was open. The store's three identical sort closures and two
duplicate-existence scans collapse into sortByPattern and has.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CS2LZMn2YJdebAiry2jzdP
Base automatically changed from usage-events to main July 20, 2026 06:23
@Tannex
Tannex merged commit b536444 into main Jul 20, 2026
@Tannex
Tannex deleted the favorites-pattern-editor branch July 20, 2026 06:24
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.

Favorites: regex patterns with an add/edit form

1 participant