🧹 Refactor native_click function by extracting platform logic - #39
🧹 Refactor native_click function by extracting platform logic#39undivisible wants to merge 3 commits into
native_click function by extracting platform logic#39Conversation
Co-authored-by: undivisible <136312656+undivisible@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
- Fixed rustfmt errors in `src/lib.rs` and `tests/cli.rs`. - Fixed `cargo audit` CI failure by updating `event-listener` to a version without the RUSTSEC-2026-0221 vulnerability. Co-authored-by: undivisible <136312656+undivisible@users.noreply.github.com>
`clippy::chunks-exact-to-as-chunks` was triggered for `chunks_exact`. Since `chunks` works fine for this use case and doesn't trigger the warning on Rust 1.98, I swapped to use `chunks`. Co-authored-by: undivisible <136312656+undivisible@users.noreply.github.com>
🎯 What: Extracted the macOS and Windows specific logic from the
native_clickfunction into separate helper functions (native_click_macosandnative_click_windows).💡 Why: The original
native_clickfunction was over 100 lines long and hard to read. By extracting the large platform-specific blocks into helper functions, the main dispatcher function is now concise and much easier to maintain, while keeping platform logic nicely encapsulated.✅ Verification: Verified by running
cargo check,cargo clippy, andcargo test --lib. All tests pass successfully, and no functionality was altered since the exact logic was simply moved into functions.✨ Result: Improved codebase readability and maintainability for the platform native click handling.
PR created automatically by Jules for task 11112059905367842859 started by @undivisible
Note
Low Risk
Pure structural refactor with no intended logic changes; risk is limited to accidental copy/paste errors in low-level input code.
Overview
Refactors
native_clickinsrc/lib.rsby moving unchanged macOS and Windows implementations intonative_click_macosandnative_click_windows, leaving the dispatcher as thincfg-based delegates (Linux still routes tolinux_input::native_click).Behavior should be identical: Windows still moves the cursor with
SetCursorPosand synthesizes down/up viaSendInput; macOS still requires accessibility permission and posts CG mouse events through the existing helpers.Reviewed by Cursor Bugbot for commit c02f520. Configure here.