Skip to content

Typing a dead key no longer throws an error#18933

Merged
seanbudd merged 3 commits into
masterfrom
i18908
Sep 17, 2025
Merged

Typing a dead key no longer throws an error#18933
seanbudd merged 3 commits into
masterfrom
i18908

Conversation

@michaelDCurran
Copy link
Copy Markdown
Member

Link to issue number:

Fixes #18908

Summary of the issue:

After we moved to a tightened ctypes definition for user32.MapVirtualKeyEx, typing dead keys such as an acute on a German keyboard layout would throw an error such as:

  File "keyboardHandler.pyc", line 535, in _get_mainKeyName
ValueError: chr() arg not in range(0x110000)

Description of user facing changes:

No longer throws an error when typing dead keys.

Description of developer facing changes:

Description of development approach:

KeyboardInputGesture.mainKeyName: As MapVirtualKeyEx now correctly returns an unsigned int we must be more explisit about filtering out dead keys. A dead key is denoted when the highest bit is set.

Testing strategy:

  • Switched to German keyboard layout.
  • Typed an acute (to the left of backspace). No error thrown.
  • Typed an 'a'. 'a acute' was announced and typed.

Known issues with pull request:

None known.

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

…turns an unsigned int we must be more explisit about filtering out dead keys. A dead key is denoted when the highest bit is set.
Copilot AI review requested due to automatic review settings September 16, 2025 05:38
@michaelDCurran michaelDCurran requested a review from a team as a code owner September 16, 2025 05:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an error that was introduced when ctypes definitions were tightened for user32.MapVirtualKeyEx. Previously, typing dead keys (like acute on German keyboard) would throw a ValueError when trying to convert the result to a character.

  • Added explicit filtering to detect and exclude dead keys before character conversion
  • Dead keys are identified by checking if the highest bit (bit 31) is set in the 32-bit return value

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread source/keyboardHandler.py Outdated
@michaelDCurran michaelDCurran changed the title Typing a dea key no longer throws an error Typing a dead key no longer throws an error Sep 16, 2025
Copy link
Copy Markdown
Collaborator

@LeonarddeR LeonarddeR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this!

@seanbudd seanbudd enabled auto-merge (squash) September 16, 2025 23:24
@seanbudd seanbudd merged commit 3e0c84a into master Sep 17, 2025
74 of 77 checks passed
@seanbudd seanbudd deleted the i18908 branch September 17, 2025 00:10
@github-actions github-actions Bot added this to the 2026.1 milestone Sep 17, 2025
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.

Typing US International dead keys raises error on most recent Alpha builds

4 participants