-
Notifications
You must be signed in to change notification settings - Fork 318
Avoid rendering dead keys (2nd attempt) #945
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@Snaptags this fix seems to be working fine with Neo. Can you please give it another try? |
Dead key handling is working perfectly! Thank you for this great fix. |
// We got an 'OemXXX' ConsoleKey, '\0' key char, and no 'Ctrl' modifier. It's very likely generated by a dead key. | ||
// We check for 'Ctrl' modifier because it's easy to generate '\0' KeyChar and 'OemXXX' by combinding 'Ctrl' with | ||
// another special key, such as 'Ctrl+?' and 'Ctrl+;'. | ||
isDeadKey = (c == '\0') && (consoleKey >= ConsoleKey.Oem1 && consoleKey <= ConsoleKey.Oem102) && !isCtrl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a large gap of invalid values in that range - maybe you should use a switch?
You also miss OemClear
in that range.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only see the OemXXX ConsoleKey
s generated for the dead keys that I have inspected so far ... Yes, OemClear
is not in that range. I didn't include it only because I didn't see it was generated by the dead keys I have inspected :) I will keep the check as is for now, and change it as needed when there are new dead-key issue reported.
Use a heuristic check to determine if a key pressing is a dead key. Fix #914
The Win32 API
ToUnicode
doesn't work well with non-natively-supported keyboard layouts, such as the Neo keyboard layout.ToUnicode
maps Neo dead keys to unicode characters incorrectly and results in PSReadLine rendering the dead keys.