Files
pdfcraft/crates
Francesco UrbaniandFredApps 90d847ce17 Select the current query when refocusing search fields (#4533)
* Search field receives a focus request

* Find keeps an IME composition when the find field already has the keyboard

Selecting the query on Find made the next IME update replace the whole
query when the field was composing: egui replaces the selected range,
and only egui can end a composition from inside the field. The query is
now selected only when the field takes the keyboard from elsewhere, in
one helper for the find bar and the Search panel.

* Test that the Search panel keeps an IME composition when asked for the keyboard again

* A repeated Find selects the query while the field has the keyboard

`owns_ime_events` is only `has_focus` on the pinned egui, so a second Find
while the find field (or the Search panel field) still had the keyboard
kept the caret and typing appended to the old query. Follow the IME
composition from the field's own events and cursor instead: a non-empty
pre-edit starts it, a commit or empty pre-edit ends it, and any other edit,
click or loss of focus ends it too. Only a live composition keeps the
selection; every other Find selects all of the query.

Tests: a repeated Find with the keyboard still in the field, for both
fields, and a Find after a committed composition.

---------

Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
2026-11-16 10:00:37 +01:00
..
…
2026-11-13 18:59:56 +01:00