feat(ui): paste the selected clip with Enter and hide on Escape - #8
Open
hadoukim wants to merge 3 commits into
Open
feat(ui): paste the selected clip with Enter and hide on Escape#8hadoukim wants to merge 3 commits into
hadoukim wants to merge 3 commits into
Conversation
Enter now pastes the clip the arrow keys landed on: the list's row-activated signal routes the focused row through the same copy path as a click. Single-click activation is turned off so it doesn't double up with ClipCard's own click gesture (copy / Ctrl-pin). Escape hides the window, via a capture-phase key controller on the content so it takes precedence over the search entry's clear-on-Escape.
Enter typed mid-search hit the entry's own Return binding instead of pasting, so the reported repro never worked. Handle the keys on a capture-phase controller at the window, ahead of the focused child, and make the list selection the cursor Enter acts on. The key mapping moves to a pure key_action() policy that unit-tests headless. Dialogs and popovers keep their own keys, a focused button keeps Enter, copy() guards against the double activation ClipCard could already emit, and hide() clears the filter on every exit path. Closes Walkercito#7
Pinning recreates the card the cursor sits on, so the selection died with it and apply_filter snapped the cursor to the top of the list. Remember the selected content across the rebuild and put the cursor back on it. Ctrl+click reaches GtkListBox as a selection toggle and can leave nothing selected, which left the arrows dead until the next filter pass; they now start at the top when there is no cursor to move.
Owner
|
I'm still testing to make sure everything's all right with the performance. I'll merge it soon 😅 |
Author
Yeah no rush, thanks for working on it ! |
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.
What
row-activatedsignalroutes the keyboard-focused row through the same copy path as a click,
so after navigating with ↑/↓ you can paste with Enter.
How
Gtk::ListBox::signal_row_activated→copy()(deferred to an idle,like
ClipCarddoes on click, so the row isn't torn down mid-event).set_activate_on_single_click(false)so activation doesn't double upwith
ClipCard's own click gesture (copy / Ctrl-pin).EventControllerKeyon the content box catches Escapebefore the search entry's clear-on-Escape and hides the window.
Testing
Built with the
debugpreset (clean under-Wall -Wextra -Wpedantic -Wconversion -Wshadow -Werror) and run against a live GNOME/Waylandsession: ↑/↓ navigate, Enter pastes the highlighted clip, Escape closes.