Skip to content

feat(ui): remove the highlighted clip with the Delete key - #12

Merged
Walkercito merged 2 commits into
Walkercito:mainfrom
hadoukim:feat/delete-clip
Aug 12, 2026
Merged

Walkercito merged 2 commits into
Walkercito:mainfrom
hadoukim:feat/delete-clip

Conversation

@hadoukim

Copy link
Copy Markdown
Contributor

What does this PR do?

Delete (and KP_Delete) removes the highlighted clip, then moves the cursor
to the next match so it can be held to clear items down the list. During an
active search Delete still edits the query text (forward-delete), so filtering
is unaffected — Escape leaves search mode first.

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Docs
  • Build / CI

Checklist

  • The build is clean — warnings are errors (-Werror).
  • ctest --preset debug passes. (153/153)
  • The sanitizer build passes: cmake --build --preset asan && ctest --preset asan (zero leaks, zero UB).
  • clang-format is clean (v18.1.8, the pinned version); clang-tidy is left to CI, per the project's .pre-commit-config.yaml.
  • Commits follow Conventional Commits, with no AI/assistant trailers.
  • A change to core/ ships with tests. — N/A, no core/ change; the added KeyAction policy (ui/) ships 3 new unit tests.
  • Docs (README / CONTRIBUTING) updated if behavior changed. — README shortcuts table gains the Delete row.

Notes for reviewers

  • RemoveSelected is gated off while a search is active so Delete keeps editing
    the query; the decision lives in the pure, unit-tested KeyAction policy.
  • remove_selection() hands the cursor to the surviving neighbour before calling
    the existing HistoryService::remove() (which drops the clip whatever its pin
    state, unlike the Clear button's clear_unpinned).

@hadoukim

Copy link
Copy Markdown
Contributor Author

I'll resolve the conflicts tomorrow

@Walkercito

Copy link
Copy Markdown
Owner

Okay

Delete (and KP_Delete) removes the highlighted clip, handing the cursor
to the next match first so it can be held down the list. During an active
search Delete still edits the query text (forward-delete), so filtering is
unaffected. The pure KeyAction policy gains RemoveSelected and is
unit-tested.
@Walkercito
Walkercito self-requested a review August 12, 2026 16:58
@Walkercito Walkercito added the enhancement New feature or request label Aug 12, 2026
@Walkercito

Copy link
Copy Markdown
Owner

All right, I'll add some tests fist, looks good to me

key_action() re-read search_active on every press, so a run of Delete
presses that began as text editing turned destructive the moment the
query emptied: type a filter, select all, Delete, and one overshoot
press removed a clip. Held down, autorepeat cascaded through several.
Removal has no undo and no confirmation.

Latch the run's role on its opening press and clear it on release, so
the first press decides for the whole run. present() resets the latch,
since a Delete held across a hide never delivers its release.

Also cover the modifier, keypad, and rebinding edges of the key, plus
HistoryService::remove on pinned, subscribed, and absent entries.
@Walkercito
Walkercito merged commit ac723ee into Walkercito:main Aug 12, 2026
3 checks passed
@hadoukim
hadoukim deleted the feat/delete-clip branch August 13, 2026 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants