Improved Input Help Mode to Report Characters Typed by Key Combinations in Normal Mode (#19422)
Fixes #6621
Summary of the issue:
In input help mode, NVDA only reports the key combination name but does not report what character would be typed by that key combination in normal mode.
Description of user facing changes:
Input help mode now reports the key combination first, and then, when appropriate, the character that key combination would type in normal input mode.
For example, pressing Shift+1 on a US keyboard will report shift+1, then !
For key combinations that produce a printable character, input help can now additionally report that character when it provides extra information
If the key combination is bound to a command or script, the existing behavior is preserved, i.e. the command description is reported rather than an extra typed character
Differences that are only in case are now reported correctly as well, for example uppercase letters
Description of developer facing changes:
Added an inputHelpCharacter auto property to the InputGesture base class in inputCore.py, provided by _get_inputHelpCharacter
KeyboardInputGesture in keyboardHandler.py uses ToUnicodeEx to infer the character the gesture would produce in normal input mode
KeyboardInputGesture overrides _get_inputHelpCharacter to expose that extra character to input help when appropriate
_handleInputHelp now handles the gesture display name, gesture.inputHelpCharacter, and script description separately
Description of development approach:
Based on the abandoned PR #15907(by @Emil-18) and #17629. The implementation uses ToUnicodeEx with the 0x04 flag to get the character without modifying keyboard state. Dead key results are preserved for input help handling. Input help reports the gesture name first, and only adds the character when it provides additional information.