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

x/exp/shiny: value of event/key.Event.Rune inconsistent across platforms while control key is pressed #17011

Open
aarzilli opened this issue Sep 7, 2016 · 6 comments

Comments

@aarzilli
Copy link
Contributor

commented Sep 7, 2016

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.7 linux/amd64
go version go1.7 windows/amd64

What did you do?

Open a shiny window, log key events received, press ctrl+C on the window.

What did you expect to see?

I expected the value of event/key.Event.Rune to be the same on linux and windows

What did you see instead?

On linux ctrl+C produces the rune 'c', on windows 0x3 is reported instead. This isn't limited to 'c' all ctrl+key combinations produce different results on windows and linux. I think that the value of Rune should either be the same across platforms or always set to -1 when ctrl is pressed.

@quentinmit quentinmit added this to the Unreleased milestone Sep 7, 2016

@alexbrainman

This comment has been minimized.

Copy link
Member

commented Sep 8, 2016

We could do something similar to https://git.merproject.org/mer-core/qtbase/blob/dfe853bff90444edf92a993e391df853780c9e8d/src/plugins/platforms/windows/qwindowskeymapper.cpp#L539 (I just googled), if we want to return 'c' on windows.

Leaving for to @crawshaw and @nigeltao to decide.

Alex

@aarzilli

This comment has been minimized.

Copy link
Contributor Author

commented Sep 8, 2016

I have noticed that there are also other discrepancies: CodeReturnEnter gets '\r' on windows, '\n' on linux; CodeTab and CodeDeleteBackspace return '\t' and '\b' on windows but -1 on linux.

@nigeltao

This comment has been minimized.

Copy link
Contributor

commented Sep 9, 2016

Let me think about it...

@nigeltao

This comment has been minimized.

Copy link
Contributor

commented Sep 12, 2016

I think that all platforms should behave the same. Specifically:

Ctrl-A should have Rune == -1.

CodeReturnEnter has Rune == '\n', especially as you can't set Rune == "\r\n" (a string) on Darwin.

CodeTab should have Rune == '\t'.

CodeDeleteBackspace (and CodeEscape) should have Rune == -1. I wouldn't expect a text editor to want '\x08' or '\x1b' runes inserted into the text.

WDYT? I'm happy to do the Linux and Mac changes if there's consensus.

@alexbrainman

This comment has been minimized.

Copy link
Member

commented Sep 12, 2016

WDYT?

I don't use this package myself, so I am fine with whatever you decide. We could always change our mind once we know more.

Alex

@aarzilli

This comment has been minimized.

Copy link
Contributor Author

commented Sep 12, 2016

I'm ok with this, but:

Ctrl-A should have Rune == -1.

what happens if the user presses Ctrl+<Some key that doesn't exist on a US keyboard>?

@ALTree ALTree changed the title x/exp/shiny: value of event/key.Event.Rune inconsisntent across platforms while control key is pressed x/exp/shiny: value of event/key.Event.Rune inconsistent across platforms while control key is pressed Sep 22, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.