Repository navigation
fix(ui-egui): Ctrl+F and Ctrl+E go to the search box, not into the note (#134) - #184
Merged
Merged
Conversation
With the caret in a page, Ctrl+F did nothing and the words typed next, meant as a search, were written into the note (AlienTechSoftware#134). Ctrl+F, and Ctrl+E as OneNote has it, are now taken before the page sees them and put the keyboard in the Search all pages box. The code view keeps its own Ctrl+F Find while it is open. Fixes AlienTechSoftware#134 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 and why
Fixes #134. In the ordinary page editor, Ctrl+F wasn't handled at all. With the caret in a paragraph, the key went nowhere and the next text,
findneedlein the issue, was inserted into the note and saved.Ctrl+F, and Ctrl+E (OneNote's key for searching all notebooks, as the issue suggests), are now consumed in the window's shortcut handling. That's the same place Ctrl+S / Ctrl+Z / Ctrl+Y are taken, before any widget sees them. They move the keyboard to the existing Search all pages box in the title bar, through the same
focus_searchpath its search button uses, and drop any pending caret focus request. While the code view is open the shortcut is left alone, because the code view has its own Ctrl+F Find for the file it shows.Escape in the search box gives the focus up as before. Clicking back into the page puts the caret where it's clicked. A per-page Find bar (highlighting matches inside the current page) would be a larger feature. This fixes the routing, so typing a query can no longer edit the note.
How it was checked
ctrl_f_in_the_page_goes_to_search_and_writes_nothing, run for both Ctrl+F and Ctrl+E: caret in a paragraph, press the key, typefindneedle. The page body is unchanged and the query is in the search box. Fails without the fix (the query lands in the note), and passes with it.the_code_view_colours_the_file_and_finds_text_in_it, which uses Ctrl+F) still passescargo test -p notecraft-ui-egui: all pass (302 unit, 203 UI)cargo fmt --all -- --check,cargo clippy -p notecraft-ui-egui --all-targets -- -D warnings: clean🤖 Generated with Claude Code