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

Fix: the unicode from U+2000 to U+2FFF could not be gotten #38

Merged
merged 1 commit into from
Sep 29, 2020
Merged

Fix: the unicode from U+2000 to U+2FFF could not be gotten #38

merged 1 commit into from
Sep 29, 2020

Conversation

hymkor
Copy link
Contributor

@hymkor hymkor commented Sep 21, 2020

I found some characters between U+2000 and U+2FFF which can not be gotten by ReadRune in Windows.
For example, and .

We can see the problem as below. (I did on Windows10)

  1. Copy ∞Ⓓ to the clipboard on the web browser.
  2. go run _example/readline.go
  3. Paste those characters from the clipboard by mouse-right-button.
  4. We expect all of them are inserted, but we see no ones are inserted.

( See also nyaosorg/nyagos#390 . And haskell/haskeline#54 may be the similar problem )

I made the test program and saw the strange data from ReadConsoleInput.

  1. On KeyDown event, the field UnicodeChar is zero. (Why!?)
  2. On KeyUp event, th field UnicodeChar is valid as expected.
  3. In some cases , trash data? may be inserted between two events.

I do not understand the reason that those input are given from ReadConsoleInput.
But, I want to fix the problem, so I made the patch for a workaround.
( A better solution may be exist, but I could not find it.)

Would you merge this patch if problems do not exist , @mattn ?

hymkor added a commit to nyaosorg/go-readline-ny that referenced this pull request Sep 22, 2020
@mattn
Copy link
Owner

mattn commented Sep 28, 2020

Thank you. Please take me a little time to understand what this fixes.

@mattn
Copy link
Owner

mattn commented Sep 28, 2020

Is this correctly on Linux?

@hymkor
Copy link
Contributor Author

hymkor commented Sep 28, 2020

For Linux, I have not modified any codes for Linux-dependent and OS-independent part because I considered the codes for Linux do not call ReadConsoleInput directly.

As far as I experimented on WSL-1 of Windows10 now, go-tty looks to work finely when ∞Ⓓ are pasted whether my patch is included or not on Linux .

@mattn mattn merged commit b0f19ff into mattn:master Sep 29, 2020
@mattn
Copy link
Owner

mattn commented Sep 29, 2020

Thank you

@hymkor hymkor deleted the fork20200922 branch September 29, 2020 03:01
@hymkor
Copy link
Contributor Author

hymkor commented Sep 29, 2020

Thank you for merging.
When I know the reason for the behavior of ReadConsoleInput , I would report it or send a better code.

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

Successfully merging this pull request may close these issues.

2 participants