vscode: Unable to type in Chinese in integrated terminal
Issue Type: Bug
打开内置终端 无法输入中文,
VS Code version: Code 1.53.0 (8490d3dde47c57ba65ec40dd192d014fd2113496, 2021-02-03T20:36:38.611Z) OS version: Windows_NT x64 10.0.18363
System Info
| Item | Value |
|---|---|
| CPUs | Intel® Core™ i7-8700 CPU @ 3.20GHz (12 x 3192) |
| GPU Status | 2d_canvas: enabled gpu_compositing: enabled multiple_raster_threads: enabled_on oop_rasterization: enabled opengl: enabled_on protected_video_decode: enabled rasterization: enabled skia_renderer: enabled_on video_decode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled |
| Load (avg) | undefined |
| Memory (System) | 15.86GB (11.40GB free) |
| Process Argv | –crash-reporter-id f85a41a1-239d-4bd7-a4a1-dc3c12e2b6be |
| Screen Reader | no |
| VM | 0% |
Extensions (6)
| Extension | Author (truncated) | Version |
|---|---|---|
| vscode-eslint | dba | 2.1.14 |
| vsc-material-theme | Equ | 33.1.2 |
| vsc-material-theme-icons | equ | 1.2.2 |
| git-graph | mhu | 1.28.0 |
| vscode-language-pack-zh-hans | MS- | 1.53.2 |
| vetur | oct | 0.32.0 |
(1 theme extensions excluded)
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492cf:30211402
pythonvsdeb440:30248342
pythonvsded773:30248341
pythonvspyt600cf:30251589
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 7
- Comments: 105 (18 by maintainers)
Commits related to this issue
- Update xterm.css — committed to microsoft/vscode by kena0ki 4 years ago
- chore: bump electron@11.0.3 (#111931) * chore: bump electron@11.0.3 This reverts commit 155691d0bec4acfac0e3bbccb362f61278a132de. * chore: bump x64 build image * chore: rebuild remote with o... — committed to microsoft/vscode by deepak1556 4 years ago
- xterm@4.12.0-beta.3 Diff: https://github.com/xtermjs/xterm.js/compare/4.11.0...6edfa51 Fixes #115814 — committed to code-oss-dev/code by Tyriar 3 years ago
Well, not exactly. In fact, when you set a listener to
keydownevent, you’ll find on Electron 9 it’ll fire the event when you complete the inputs, while on newer Electron like 12,keydownevent is never fired.https://user-images.githubusercontent.com/8115912/110315282-ffefc580-8043-11eb-9816-98c79fa4147a.mp4
https://user-images.githubusercontent.com/8115912/110315303-041be300-8044-11eb-82a6-1d9c1de96d9a.mp4
So there are 3 behaviors:
keyup,keydown,inputevent when you input, and the input value is what you input right nowkeyupandkeydownevent when you input, but input value is your previous input; it won’t fireinputevent until you complete it, and at this time the input value is the final inputkeyupevent when you input, and input value is your previous input; it won’t fireinputandkeydownevent until you complete it, and at this time the input value is the final input; and in newer Electron 12,keydownevent is never fired.after 1.52 version, vscode behaves like this, maybe we should find out changes which cause this problem. Some input methods call special system APIs or output text to UI in a different way. but i think vscode should support them if possible.
+100000086
what’s more interesting, the tech support of sogou think that it’s vscode’s issue. but they admitted that they have released a hotfix.🤣
@Python-37 Yes but not exactly, that’s just a solution, I don’t want to spend time on it for now since I’m still having works to do. At least, for common users, you can try these options, and for advanced users, you can build it by yourself and revert the broken commit (or just use my compiled binary, but I’m not supposed to update it).
BTW, I tried to run Xterm in Edge, a “real” browser, and it’s fun that at this time, Sogou Pinyin fires all the events we needed, and Xterm works well. But Baidu IME is still not working, just the same as in Electron.
https://user-images.githubusercontent.com/8115912/110411731-0888e000-80c6-11eb-9f06-9f7449e56d5c.mp4
https://user-images.githubusercontent.com/8115912/110411743-0cb4fd80-80c6-11eb-9a73-ccd60ad35035.mp4
keyup| 🔺 Onlykeyupon input, but will firekeydownwhen completed | ✔ All eventsSo I guess Sogou Pinyin maintains a list to determine which mode will be used for specific program, since when using Edge, its behavior is more like Microsoft Pinyin.
So at this time, I think (besides the css style problem) it’s Sogou Pinyin and Baidu IME’s fault. 🤔
@Kingwl I see some repros show
???, but some others simply do nothing.For everyone have this issue, can you please confirm which behavior you are experiencing?
You may click the 👍 for
???, and 👎 for nothing happensIt’s not only Chinese but also Japanese, Thai, Kazakh, Russian, etc. Even emoji (paste).
I guess this may caused by unicode.
+10086
The terminal can’t input Chinese characters, but the CMD in Windows system can input Chinese normally. The installed version is 1.53. How can I input Chinese
I setup a fresh new Windows 10 VM (20H2, Enterprise, x64, with VirtualBox) and grab some versions of VSCode and IMEs. By testing these various versions of VSCode and IMEs, seems that there are at least 2 reasons that blocks terminal input.
So if you’re trying to find the broken commit for Sogou Pinyin, you can try
git bisect bad 1.53.0andgit bisect good 1.52.1.Detailed screen recording videos
https://user-images.githubusercontent.com/8115912/110276716-b9cc3f00-800e-11eb-99d0-1adcc0d0b2f9.mp4
https://user-images.githubusercontent.com/8115912/110276709-b20c9a80-800e-11eb-85f1-3e214d47c83e.mp4
https://user-images.githubusercontent.com/8115912/110276713-b5078b00-800e-11eb-87a9-53796e6ef6c7.mp4
https://user-images.githubusercontent.com/8115912/110276715-b8027b80-800e-11eb-9e2d-1cb61f6d1a3a.mp4
So for now, the following IMEs on Windows are having the same problem with integrated terminal:
And an IME on Arch Linux (#112978, well yume-chan said it’s not the same problem, but another contributer has marked it as duplicated with this one)? I’ve tried running an Arch Linux with lxde in a VM, but all fcitx IMEs are working fine, maybe it occurs on IBus?
To VSCode developers or contributers, the issue has been existed for about 3 months since 1.52.0 released, and from my side I don’t see any progress on it, feeling a bit upset.
If you’re not familiar with these IMEs, at least you can try Rime, it’s an opensource IME, maybe it can helps you to find the problem.
BTW, for the working IMEs, probably they’re also having another issue that both showing input letters on VSCode UI and IME UI.
To VSCode end-user, if you’re still having this problem, maybe you can try the following options:
This issue deserves attention because it has hit a large number of Chinese developers. I thought I have to consider downgrading the version of VSCode until this problem has been fixed.
+1
I’ve merged in the fix from xterm.js, thanks all! Please try out insiders on Monday to verify it works.
I also encounter this problem. Any progress?
Sogou Pinyin input method
版本: 1.54.1 (system setup) 提交: f30a9b73e8ffc278e71575118b6bf568f04587c8 日期: 2021-03-04T22:38:31.419Z Electron: 11.3.0 Chrome: 87.0.4280.141 Node.js: 12.18.3 V8: 8.7.220.31-electron.0 OS: Windows_NT x64 10.0.19042
Is there any progress ? I’m sure it’s an urgent issue.
I met same bug, I found that Windows builtin input method can use normally, some other input methods cannot input Chinese. When I met this bug, I thought that it’s because of the input method I am using. BTW, VS Code in GNU/Linux works normally too.
Well, i have done a little more work to investigate it.
In MDN Web Docs: https://developer.mozilla.org/en-US/docs/Web/API/Element/compositionstart_event
And xterm depends on this
web eventtotally to compose console string byCompositionHelper.But , you see, Sogou Pinyin wouldn’t fire the
compositionstartwhen input starting.In Chrome (not chromium or Electron), browser work very well on firing this event with Sogou Pinyin.
What’s more important, i think that xterm will break its design if a series of hacking codes inserted into its source just for solving this problem.
So, maybe it’s necessary to ask the developers or maintainers of electron to focus on the problem,
A web stardard like
compositionstart, browsers should follow what it specifies.maybe IMEs using not good API, can’t make electron (or chromium) to fire the event, but in old versions of electron, they can handle Sogou IME well.
@ZhyMC Yep, so we’ve already dig in deep enough, there are at least two major issue needs to be resolved:
keydownevent when using Sogou Pinyin, so that Xterm cannot measure IME has completed the inputs.Until you’re willing to dive into how Xterm or Electron works, maybe we should let VSCode’s contributors to complete the rest job, I guess.
Version 1.54.1 is released, but this bug is stiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiill able to reproduced.👿
Is it possible to make it compatible with these IMEs? As based on latest comments, it still happens on Sogou Pinyin (thought I didn’t reproduce it), and I guess Sogou Pinyin, QQ Pinyin and Rime are the top 3 using 3rd-party IMEs in China (at least Sogou Pinyin is definitely the most one), and all of them are well in previous version (1.51-).
Is this also apply to Linux distributions? Since the original issue I commented is on Arch Linux.
@Reilkay What’s your IME using on Arch Linux? And are you still experiencing the same problem in latest VSCode?
@Reilkay 你在 Arch Linux 上使用的输入法是什么?在最新的 VSCode 下是否仍存在无法在终端输入中文的问题?
我暂时用了微软拼音输入法,没问题 搜狗输入法不能输入中文
Not one, but multiple third-party IMEs. They all worked fine before 1.52 and still work fine in all other programs and even in code editors after 1.52.
So definitely something has been changed in either Electron, Code or Xterm.js that affected these IMEs.
If you believe it’s those IMES’ fault, at least we need some directions to how we can “fix” them to conform the way you require.
Thanks your reply, I try windows native input methods, it works!
me too
me too
Checked and confirmed that both QQ Pinyin and Rime (Weasel) work fine on today’s Insider build.
1.54.3 worked
hot update is nb
@ccloli Hahaha, at this time, i think the best solution is that uninstall the Sogou IME and try something else. And revert the commit which causes the css style problem.
hey guys, i think i found the reason.
in
/src/browser/input/CompositionHelper.tsof xtermjs/xterm.jswe can find the code snippet:
i set up a
keydownlistener by using DevTools, and print theev.keyCodewhen i am typing in words.By seaching in google, i found that
229is a special keyCode event fired with that when you typing Chinese or characters of some other languages.so the issue is caused by electron
11.x(maybe that’s because of its dependency: chromium ) the event with that keyCode229would never fired when typing Chinese for some IMEs like Sogou IME and Baidu IME.index.html
@ZhyMC If that’s true, at least for Sogou Pinyin, it would be like what’s @yume-chan said:
Though it’s still weird that only integrated terminal is affected, the other modules of VSCode is fine. And it seems that it cannot be fixed by a simple downgrade, since
1.53.0updates Electron from9.xto11.x, which crosses 2 major version. So hopefully it would be fixed by newer Electron, or xterm does some compatibility works.BTW, looks like Electron upgrade only affects to Sogou Pinyin (as previous comment, QQ Pinyin and Rime are because of some css layout issue, and revert them can still works on latest build with newer Electron).
hey guys , i have made progress by using
somebody can verify this.
git bisectthe bad commit is: 94142bd7e0dbc073fe6abf130d7b7066a7beb1d6
if it is verified, maybe the issue comes from the upstream : Electron.
@ccloli Before your tip, i don’t even know that git has
git bisectcommand. That’s quite a good way to find what causes the problem, i am trying to fix it in my environment. And I just spent long time to fixyarn watchproblem, right now i know how to deal with it.bad news, doesn’t work even that’s a fixed prebuilt.
@ZhyMC Well, I built it just now, can you help me to verify if it works for you? At least it works for me.
https://1drv.ms/u/s!As4fpXfOPou9ghCE3bCZXVu8u1gk?e=SeLPHO https://pan.baidu.com/s/1RrvKGtkKYWMMgVpSjy6mIQ
us4xIf you’re not satisfy with prebuilt binary, you can also TIY by following these steps, just to be sure that after you clone the repo, run
git revert 4b49bae.1.52 can work normally.
You can find previous version here. https://code.visualstudio.com/updates/v1_50
搜狗输入法就没法输入中文,自带输入法就可以。。。难受
我最初也以为是输入法问题,因为我使用 Rime 输入法出现了这个问题,但是用系统内建输入法之后就正常了,于是提了这个issue https://github.com/rime/weasel/issues/605 但是上面有其他用户提到了其他的输入法也出现了同样的问题,而且我自己使用 Rime 输入法在之前版本的VSCode中运作正常,所以原因应该不在输入法上。
I initially thought it’s because of input method’s bug, because I met this problem when I’m using Rime input method, but after I exchanged to Windows built-in input method, VSCode’s terminal works fine. However, other users above mentioned that some other input methods have the same problem, and Rime input method works fine in the previous version of VSCode, so the problem should not come from the input method.
I tested this and found the following:
Well, I think #112978 is the same problem describe here.Okay, looks like it’s not a same issue, I got nothing instead of???, but I’m in 1.52.1 instead of 1.53.0. I also tried the latest insider build (1.54.0-insider, afd102cbd2e17305a510701d7fd963ec2528e4ea), the behavior is the same as previous version and doesn’t get???.In detail, when you input
xletters in terminal, they are not showing in terminal, then if you inputyletters, theny - xof last letters will be shown.Also this is not limited to CJK letters, when you input English letter with these CJK IME (you can press Enter to send your input Elnglish letters), they will be gone, too.
For example, if you input
abcdefghijklmnopqrstuvwxyzin sequence, the input letters will be likeabcmntyz(sometimes I gotabcmnopqrstyzwhich is a bit weird, it seems that before inputingopqrst,xis reset to0).BTW, pasting text with Chinese letters into terminal works fine, it only happens when inputing with some CJK IME (some IME like Microsoft Pinyin works fine here).
I have this problem too. My version is 1.53.But what I have found so far is that the QQ input method and the Microsoft input method can input Chinese, while the sogou input method cannot input Chinese.
It’s not new, I can reproduce this on both 1.52 and 1.51 (didn’t try to find a working one). xterm.js in browser works fine.