readline icon indicating copy to clipboard operation
readline copied to clipboard

Keyboard in US International inserts char \0 when pressing '+space (dead keys)

Open johnnyasantoss opened this issue 6 years ago • 5 comments

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

johnnyasantoss avatar Jan 16 '19 09:01 johnnyasantoss

There is nothing wrong with the API. Use the ReadLine.Demo.

var input = ReadLine.Read("(prompt)> ");
Console.WriteLine(input);

Assert.True(input, "' ");

Latency avatar Jan 24 '19 03:01 Latency

Sorry, I think you got it wrong. I meant ' (apostrophe) + (space)

johnnyasantoss avatar Jan 24 '19 13:01 johnnyasantoss

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.

Latency avatar Feb 03 '19 15:02 Latency

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

image the arrows indicate where the spaces are inserted, when a ' is typed

vip32 avatar Mar 28 '19 09:03 vip32

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.

xavierpena avatar Feb 28 '23 09:02 xavierpena