You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Find in page: ⌘F and ⌘E use the selected text, and open the find bar as usual without one
#6152
Problem
Select text on a page and press ⌘F: the find bar opens with the tab's previous query, or empty. To search for the selected text you have to copy and paste it, or know that ⌘E (Use Selection for Find) exists.
Proposal
When ⌘F is pressed with text selected on the page, open the find bar with that text filled in and selected, and search for it right away. Typing replaces it.
⌘F with nothing selected: same as today.
⌘E with nothing selected: open the find bar as ⌘F does. Today it does nothing. Either key then works with or without a selection.
Selection is very long: ignore it. Chromium skips selections over 250 characters.
Why it fits
Upstream Chromium does this in FindBarController::Show(): it fills the find bar from the selection unless the user has already typed in that find session. I read this in the source and haven't compared it with Dia.
Where it could go use_selection_for_find in crates/ardia-ui/src/window/commands.rs already reads the selection and opens the bar with FindMsg::OpenWith. Command::FindInPage currently sends plain FindMsg::Open, which keeps the old query. The read is async, so ⌘F should still open and focus the bar at once (so a quick ⌘V or typing lands in it), then fill in the selection only if nothing has been typed meanwhile.
I haven't built this. Happy to send a PR if you'd take it.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Problem
Select text on a page and press ⌘F: the find bar opens with the tab's previous query, or empty. To search for the selected text you have to copy and paste it, or know that ⌘E (Use Selection for Find) exists.
Proposal
When ⌘F is pressed with text selected on the page, open the find bar with that text filled in and selected, and search for it right away. Typing replaces it.
Why it fits
Upstream Chromium does this in
FindBarController::Show(): it fills the find bar from the selection unless the user has already typed in that find session. I read this in the source and haven't compared it with Dia.Where it could go
use_selection_for_findincrates/ardia-ui/src/window/commands.rsalready reads the selection and opens the bar withFindMsg::OpenWith.Command::FindInPagecurrently sends plainFindMsg::Open, which keeps the old query. The read is async, so ⌘F should still open and focus the bar at once (so a quick ⌘V or typing lands in it), then fill in the selection only if nothing has been typed meanwhile.I haven't built this. Happy to send a PR if you'd take it.
All reactions