Skip to content

fix(settings): add the scroll offset when a click selects a settings row - #744

Merged
LargeModGames merged 3 commits into
LargeModGames:mainfrom
drakeo338:claude/661-settings-click-scroll
Oct 11, 2026
Merged

LargeModGames merged 3 commits into
LargeModGames:mainfrom
drakeo338:claude/661-settings-click-scroll

Conversation

@drakeo338

@drakeo338 drakeo338 commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #661. A click in a scrolled Settings list counted rows from the top of the box without the scroll offset, so it selected a row out of view. select_clicked_setting now uses list_item_index_from_click with the drawn selection's position (selected_setting_position), like the other lists. The unused settings_item_index_from_click is removed. Two tests in mouse.rs cover a scrolled and an unscrolled list; CHANGELOG has a Fixed entry.

Testing

  • cargo test --no-default-features --features telemetry,tui handlers::mouse: 42 passed; on the test-only commit the scrolled test fails (left: 0, right: 26).
  • Full cargo test --locked --no-default-features --features telemetry,tui: 1508 passed, 0 failed.
  • cargo clippy ... -D warnings, cargo fmt --check, tools/check_gates_ratchet.sh: clean.

Additional notes

Not clicked through in a real terminal; the tests drive the handler at a 100x20 viewport. Written with help from an AI coding agent; I read the diff and ran the checks above.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed row selection in scrolled Behavior and Keybindings settings lists so clicks select the correct setting.
    • Fixed clicks in filtered settings lists so they select the setting under the pointer after scrolling.

@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: LargeModGames/spotatui/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d1e84da2-4627-43b2-b5ce-ccc83e0a3e8c

📥 Commits

Reviewing files that changed from the base of the PR and between 5af8200 and 19eac36.


📒 Files selected for processing (1)
  • CHANGELOG.md

🚧 Files skipped from review as they are similar to previous changes (1)
  • CHANGELOG.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.



📝 Walkthrough

Walkthrough

Settings-row clicks now account for list scrolling when mapping mouse positions to filtered settings. The change removes the previous top-based row mapping and adds tests for clicks in scrolled and unscrolled lists.

Changes

Settings row selection

Layer / File(s) Summary
Map clicks to visible settings rows
src/tui/handlers/mouse.rs, CHANGELOG.md
The mouse handler uses the selected setting’s position in the filtered view to map clicks to visible rows and removes the previous row-mapping helper. Tests cover clicks before and after scrolling. The changelog describes the fix.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium


Merge Risk: ⚪ Minimal · up to 19eac

No actionable issue is identified in the reviewed change; it is mergeable after normal checks.

Pre-merge checks | Passed 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title uses the accepted conventional-commit prefix fix(settings):, clearly describes the scroll-offset correction, and uses a concise imperative subject.
Linked Issues check Passed Issue #661 requires scroll-aware Settings click mapping for Behavior and Keybindings, use of the drawn filtered-list position, and automated scrolled and unscrolled tests. The PR uses `selected_settin…
Out of Scope Changes check Passed The changes stay within issue #661. They update Settings click mapping, add focused mouse-handler tests, and add the related changelog entry. No unrelated state change, draw-function write, or gate-co…

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

✨ Simplify code
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@LargeModGames
LargeModGames merged commit 8eea8e3 into LargeModGames:main Oct 11, 2026
31 checks passed
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.

Settings: clicking a row after the list scrolls selects the wrong setting

2 participants