readline
readline copied to clipboard
Keyboard in US International inserts char \0 when pressing '+space (dead keys)
Hello!
Thanks for creating this awesome package. I love what you are doing to improve CLI/CI scenario on the .net environment.
I'm using this package and I've noticed that when you press ' + space
outputs \0'
, which outputs only one '
char in other softwares. I think that this might be related on how you read the input (reading keys vs. reading inserted data - assuming this, not sure).
This happens because when using US International it has dead keys which can be used to change the next key. In this case I just want the '
so I need to press space
after.
https://en.wikipedia.org/wiki/Dead_key
There is nothing wrong with the API. Use the ReadLine.Demo.
var input = ReadLine.Read("(prompt)> ");
Console.WriteLine(input);
Assert.True(input, "' ");
Sorry, I think you got it wrong. I meant '
(apostrophe) +
(space)
Fixed typo in previous reply. Either way, it works regardless.
Set a break on the 2nd line and verify the 'input'. You will see that the string has both characters.
I can not find anything wrong with the API as it returns the proper input. Share with us your solution->project or post it somewhere so we can try for ourselves exactly what you are experiencing.
yes @Latency there is some funny behavior when using US international keyboard (which has deadkeys like ' and " to set accents on following characters).
what i see is that spaces are inserted when such a dead key is pressed, this is visible when typing
the arrows indicate where the spaces are inserted, when a ' is typed
With my Spanish keyboard writing "é" requires pressing "´" + "e", and the result in ReadLine.Read is not the desired one:
var input = ReadLine.Read("(prompt)> ");
Console.WriteLine(input);
// This fails, input is "\0é" instead:
Assert.IsEquals(input, "é");
...although if I write "é" in my text editor, copy it and then paste it in the input, it works perfectly.