Skip to content

🧹 Refactor scroll implementation into OS-specific helper functions - #49

Open
undivisible wants to merge 4 commits into
mainfrom
code-health-scroll-refactor-6718624537651276967
Open

🧹 Refactor scroll implementation into OS-specific helper functions#49
undivisible wants to merge 4 commits into
mainfrom
code-health-scroll-refactor-6718624537651276967

Conversation

@undivisible

@undivisible undivisible commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

🎯 What: The scroll function in src/lib.rs was 81 lines long due to heavy #cfg conditionals mixing macOS, Windows, and Linux logic into a single method body.
💡 Why: Splitting this logic into discrete windows_scroll and mac_scroll helper functions drastically simplifies the main scroll dispatch block, enhancing readability and isolating OS-specific code paths, which improves maintainability.
Verification: Validated that functionality is logically equivalent, confirmed no new issues were introduced via cargo check, cargo fmt, cargo clippy, and verified successfully against the local unit test suite cargo test --lib.
Result: The scroll function is now clean, readable, and properly delegates to its newly extracted OS-specific counterparts.


PR created automatically by Jules for task 6718624537651276967 started by @undivisible


Note

Low Risk
Mechanical move of platform scroll code with no intended behavior change; Linux path untouched.

Overview
Refactors native scroll input so Windows and macOS logic live in dedicated helpers instead of a long inline scroll method.

windows_scroll and mac_scroll hold the existing SendInput / Core Graphics scroll-wheel behavior unchanged. NativeRuntime::scroll now only dispatches to Linux (native_scroll), windows_scroll, or mac_scroll behind the same #[cfg] gates as before.

Reviewed by Cursor Bugbot for commit 70ddf73. Configure here.

Extracted Windows and macOS scrolling implementations into standalone OS-specific functions (`windows_scroll` and `mac_scroll`) to drastically reduce the complexity and length of the `scroll` dispatcher function.

Co-authored-by: undivisible <136312656+undivisible@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

google-labs-jules Bot and others added 3 commits August 27, 2026 05:23
Extracted Windows and macOS scrolling implementations into standalone OS-specific functions (`windows_scroll` and `mac_scroll`) to drastically reduce the complexity and length of the `scroll` dispatcher function.

Fixes RUSTSEC-2026-0221 by updating `event-listener` to 5.4.2 in Cargo.lock.

Co-authored-by: undivisible <136312656+undivisible@users.noreply.github.com>
Extracted Windows and macOS scrolling implementations into standalone OS-specific functions (`windows_scroll` and `mac_scroll`) to drastically reduce the complexity and length of the `scroll` dispatcher function.

Fixes RUSTSEC-2026-0221 by updating `event-listener` to 5.4.2 in Cargo.lock.

Co-authored-by: undivisible <136312656+undivisible@users.noreply.github.com>
Keep only the OS-specific scroll helper extraction.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant