Find-in-page works but always matches case-insensitively, with no way to change it. Ctrl+F in any other browser has these toggles.
Where the code is
The matching happens in an injected script, not in Rust. src-tauri/src/commands/browser/scripts/chrome_features.js defines window.__zynlexFind(query), which calls a findAll(query) helper and highlights the results.
The Rust side is a thin wrapper. src-tauri/src/commands/browser/find.rs has browser_find, browser_find_next and browser_stop_find, and they just build a JS call as a string and evaluate it.
The UI is src/components/browser/FindBar.tsx.
What needs doing
- Add two toggle buttons to
FindBar.tsx. Aa for case sensitivity, and something for whole word.
- Thread the two booleans through
browser_find in find.rs. Note that the JS call is built by string formatting, so the query already goes through js_string_literal for escaping. Keep using it.
- Update
findAll in chrome_features.js to respect both flags. Whole-word matching usually means a regex with \b boundaries, but be careful escaping the user query before putting it in a regex, it is arbitrary input.
- Re-run the search when either toggle changes so results update immediately.
Worth knowing
- The existing highlight logic wraps matches with
range.surroundContents(mark). It is already inside a try/catch because that call throws when a range crosses element boundaries. Do not remove that.
- The result count reported back to the UI needs to stay correct after filtering.
- Keep the toggles keyboard-reachable, Ctrl+F users tend not to touch the mouse.
Reasonable first issue if you want to touch a bit of Rust and a bit of frontend without needing to understand the WebView2 COM layer.
Find-in-page works but always matches case-insensitively, with no way to change it. Ctrl+F in any other browser has these toggles.
Where the code is
The matching happens in an injected script, not in Rust.
src-tauri/src/commands/browser/scripts/chrome_features.jsdefineswindow.__zynlexFind(query), which calls afindAll(query)helper and highlights the results.The Rust side is a thin wrapper.
src-tauri/src/commands/browser/find.rshasbrowser_find,browser_find_nextandbrowser_stop_find, and they just build a JS call as a string and evaluate it.The UI is
src/components/browser/FindBar.tsx.What needs doing
FindBar.tsx. Aa for case sensitivity, and something for whole word.browser_findinfind.rs. Note that the JS call is built by string formatting, so the query already goes throughjs_string_literalfor escaping. Keep using it.findAllinchrome_features.jsto respect both flags. Whole-word matching usually means a regex with\bboundaries, but be careful escaping the user query before putting it in a regex, it is arbitrary input.Worth knowing
range.surroundContents(mark). It is already inside a try/catch because that call throws when a range crosses element boundaries. Do not remove that.Reasonable first issue if you want to touch a bit of Rust and a bit of frontend without needing to understand the WebView2 COM layer.