Skip to content
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

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

Open
johnnyasantoss opened this issue Jan 16, 2019 · 5 comments

Comments

@johnnyasantoss
Copy link

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 johnnyasantoss changed the title Keyboard in US International inserts char \0 when pressing '+space Keyboard in US International inserts char \0 when pressing '+space (dead keys) Jan 16, 2019
@Latency
Copy link

Latency commented Jan 24, 2019

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

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

Assert.True(input, "' ");

@johnnyasantoss
Copy link
Author

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

@Latency
Copy link

Latency commented Feb 3, 2019

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.

@vip32
Copy link

vip32 commented Mar 28, 2019

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

@xavierpena
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants