Skip to content

Fix composite shortcut modifier matching#88

Closed
Dj-Shortcut wants to merge 1 commit intoAlanRockefeller:mainfrom
Dj-Shortcut:fix/keybinder-composite-modifiers
Closed

Fix composite shortcut modifier matching#88
Dj-Shortcut wants to merge 1 commit intoAlanRockefeller:mainfrom
Dj-Shortcut:fix/keybinder-composite-modifiers

Conversation

@Dj-Shortcut
Copy link
Copy Markdown

@Dj-Shortcut Dj-Shortcut commented Apr 28, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Refined keyboard modifier matching to require all specified modifiers for actions, improving shortcut reliability and preventing unintended triggers.
  • Tests

    • Added regression tests validating keyboard shortcut dispatch for white balance, batch membership toggling, and auto-adjust functionality.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 28, 2026

Warning

Rate limit exceeded

@Dj-Shortcut has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 50 minutes and 10 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 89505243-4bf8-4d14-9204-f6fbcf48e896

📥 Commits

Reviewing files that changed from the base of the PR and between aa63f27 and ce15b48.

📒 Files selected for processing (2)
  • faststack/tests/test_auto_adjust_regressions.py
  • faststack/ui/keystrokes.py

Walkthrough

Modifies keyboard modifier-key matching logic to require exact bitmask inclusion of all required modifiers, rather than any overlap. Adds regression tests for keyboard shortcuts invoking white-balance auto-adjust and batch membership toggle actions with specific modifier combinations.

Changes

Cohort / File(s) Summary
Regression Test Suite
faststack/tests/test_auto_adjust_regressions.py
Introduces new simulated controller behaviors (quick_auto_white_balance, toggle_batch_membership, raise_auto_adjust_whites) and extends Qt key enum with underscore constant. Adds regression tests validating keyboard dispatch for Ctrl+Shift+B (white-balance auto-adjust), Ctrl+B and Shift+B (batch toggle), and Shift+\_ (raise auto-adjust whites).
Keybinding Logic
faststack/ui/keystrokes.py
Tightens modifier-key matching in Keybinder.handle_key_press: entries in modifier_key_map now trigger only when event modifiers contain all required modifiers (exact bitmask inclusion) instead of any overlap between event and mapped modifiers.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ 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 directly and clearly describes the main change: fixing the composite shortcut modifier matching logic in the Keybinder component.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

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

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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 and usage tips.

@Dj-Shortcut
Copy link
Copy Markdown
Author

@coderabbitai full review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 28, 2026

✅ Actions performed

Full review triggered.

@Dj-Shortcut
Copy link
Copy Markdown
Author

What broke

The shortcut matcher treated composite modifier shortcuts as a partial match. Because Ctrl+Shift+B was checked with modifiers & mapped_modifier, pressing only Ctrl+B or only Shift+B could still trigger quick auto white balance.

Root cause

The bitmask check only required any overlapping modifier bit instead of all required bits for the mapped shortcut.

Fix

Require all mapped modifier bits to be present:

(modifiers & mapped_modifier) == mapped_modifier
This keeps Ctrl+Shift+B working while preventing Ctrl+B and Shift+B from accidentally matching the composite shortcut.

What I tested
Local verification, since CI is not running on my fork:

python -m pytest faststack/tests/test_auto_adjust_regressions.py -q

................                                                         [100%]
16 passed in 1.15s
After installing PySide6 locally, I also ran the nearby optional tests:

python -m pytest faststack/tests/thumbnail_view/test_selection.py faststack/tests/test_variants.py -q

..................................................                       [100%]
50 passed in 2.28s
Notes
Kept this intentionally narrow: no QML changes and no unrelated keybinding refactor.



@AlanRockefeller
Copy link
Copy Markdown
Owner

Suggestions for this pull request merged into #91

Thanks for your help!

@Dj-Shortcut
Copy link
Copy Markdown
Author

You're welcome

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.

2 participants