Open cm3 opened 2 years ago
Tagging subscribers to this area: @dotnet/area-system-console See info in area-owners.md if you want to be subscribed.
Author: | cm3 |
---|---|
Assignees: | - |
Labels: | `area-System.Console`, `untriaged` |
Milestone: | - |
The following API is proposed:
namespace System
{
enum ConsoleKey
{
Convert = 0x1C, // or named as ImeConvert
NonConvert = 0x1D, // or named as ImeNonConvert
ImeOn = 0x16,
ImeOff = 0x1A,
}
}
Winforms use IMEConvert
and IMENonconvert
for the API names and the same names can be preferred. https://github.com/dotnet/winforms/blob/main/src/System.Windows.Forms/src/System/Windows/Forms/Keys.cs
In the public winforms enum linked I notice a typo: "IMEAceept"..
@danmoseley That is for backward compatibility.
https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.keys?view=windowsdesktop-6.0&viewFallbackFrom=net-5.0 says "The IME accept key. Obsolete, use IMEAccept instead."
A comment in http://www.mikepope.com/blog/AddComment.aspx?blogid=2250 explains the history:
I found System.Windows.Forms.Keys.ImeAceept (ImeAccept) after we shipped it. After that, I put in a test for exposed interface on the windows forms stuff. Every time the interface changed, the test would fail, and I'd have to go look at it and make sure everything was cool. I filed over a dozen bugs on new spelling errors in the interface as a result of the test...
For now I've added this issue to https://github.com/dotnet/runtime/issues/52374, will try to tackle it when we start working on improving Console
Is it possible to recognize them on Unix?
Are you making a distinction between Linux and Unix in your statement? If not, I am happy to report that those keys are recognised on Ubuntu. If so, please wait for another report from someone.
I am happy to report that those keys are recognised on Ubuntu
Is there any chance you could run showkey -a
command line utility and press that key to see what it's being mapped to?
I've used it in https://devblogs.microsoft.com/dotnet/console-readkey-improvements-in-net-7/#sys-calls
I apologize for the significant delay in responding to your inquiry regarding the key recognition issue on Linux. After finally conducting the tests you suggested, I have some results to share.
Unfortunately, the showkey -a
command did not register any response for either of the keys in question. However, by using the xev
command, I was able to determine that the Non Convert key is recognized as keycode 102 (keysym 0xff22, Muhenkan) and the Convert key as keycode 100 (keysym 0xff23, Henkan_Mode).
The PC with Ubuntu installed, on which I intended to perform these tests, was no longer operational. In its place, I've found another PC running Peppermint Linux, which I used to conduct the tests and gather this report.
Language input keys are not defined in
That causes issues like https://github.com/PowerShell/PSReadLine/issues/2206.
So I recommend ConsoleKey to include:
Virtual-Key Codes (Winuser.h) - Win32 apps | Microsoft Docs lists up other language input keys, too. And, according to the entry in Windows Blog for Japan (Japanese), codes below also should be added.