mattn / go-tty

MIT License
208 stars 18 forks source link

Fix: some emoji could not be gotten in WindowsTerminal 1.5 #42

Closed hymkor closed 3 years ago

hymkor commented 3 years ago

After WindowsTerminal is updated to version 1.5, some emojis ( e.g.: 👨U+1F468) can not be gotten by ReadRune() like unicodes between U+2000 and U+2FFF , when they are pasted by mouse's right button.

So, I tried to fix it like #38 , but to prevent from the failure like #40 , I appended the code to check whether NUMPAD(s) are pressed or not, because when the unicode is pasted , the sequence: (1) ALT-Presse, (2) some NUMPAD(s)-Pressed/Released and (3) ALT-Released are received from ReadConsoleInput.

You can confirm by these process.

  1. Select 👨 and press Ctrl-C
  2. Execute go run _example/simple.go on the WindowsTerminal.
  3. Press mouse's right button on the WindowsTerminal to paste 👨
  4. Without this patch, simple.go can not read anythin. With it, simple.go can read as 0xD83D: � (0xD83D is the first UTF16 code of the surrogate pair)

If problems do not exist, would you please merge it , @mattn ?

hymkor commented 3 years ago

I would close this pull request because I found another problem. Only wIth this patch, U+2460 ① can not be input in Windows Terminal 1.5 thogh it can in Pure Command Prompt. ( When U+2460 is input by IME, numpad code is not recieved on ReadConsoleInput )

I continue to investigate this problem on my fork branch for a while.