codemirror / dev

Development repository for the CodeMirror editor project
https://codemirror.net/
Other
5.94k stars 377 forks source link

codemirror/view 6.28.2 version will cause abnormal input of Chinese input method #1396

Closed oeyoews closed 2 months ago

oeyoews commented 5 months ago

Describe the issue

image

https://github.com/codemirror/dev/assets/72405338/a5880b21-e9e2-4ae7-92db-a3f221e4ecd8

The last version of the commit codemirror/view will cause abnormal input of Chinese input method(IME), and some console errors will appear (the error message is not 100% reproducible for the time being)

Browser and platform

google chrome: 126.0.6478.116 Windows 11

Reproduction link

marijnh commented 5 months ago

Browser and platform No response

See that's not really helpful. Please let us know which browser, platform, and precise IME you're seeing this with.

Hydrowood0 commented 5 months ago

Browser and platform No response

See that's not really helpful. Please let us know which browser, platform, and precise IME you're seeing this with.

https://4bug-report.tiddlyhost.com/ You can reproduce this bug HERE online

oeyoews commented 4 months ago

Browser and platform No response

See that's not really helpful. Please let us know which browser, platform, and precise IME you're seeing this with.

Related information has been supplemented

Arcticn commented 4 months ago

Browser and platform No response

See that's not really helpful. Please let us know which browser, platform, and precise IME you're seeing this with.

This issue can be reproduced on https://codemirror.net/ But this is a Chromium-only problem, Firefox works perfect.

oeyoews commented 4 months ago

Browser and platform 浏览器和平台 No response 没有回应

See that's not really helpful. Please let us know which browser, platform, and precise IME you're seeing this with.看到这真的没有帮助。请让我们知道您看到的是哪个浏览器、平台和精确的 IME。

This issue can be reproduced on https://codemirror.net/本期可在 https://codemirror.net/ 上转载 But this is a Chromium-only problem, Firefox works perfect.但这是一个仅限 Chromium 的问题,Firefox 运行良好。

image Indeed it is

marijnh commented 4 months ago

What IME language are you using? (Precisely — I know you mention Chinese, but Windows supports a bunch of different Chinese IMEs.)

What key strokes demonstrate the issue? What is the expected outcome, and what happens in CodeMirror? Please describe this so that someone who doesn't know Chinese can verify the issue.

Arcticn commented 4 months ago

What IME language are you using? (Precisely — I know you mention Chinese, but Windows supports a bunch of different Chinese IMEs.)

What key strokes demonstrate the issue? What is the expected outcome, and what happens in CodeMirror? Please describe this so that someone who doesn't know Chinese can verify the issue.

For me, IME language is Chinese (Simplified, China).When comes to keyboards, both Microsoft Pinyin and Microsoft Wubi can trigger this problem

You can try to input zhongwen with Microsoft Pinyin on https://codemirror.net/ in a Chromium browser(My edge and chrome are both 126+), Firefox just works well. Seems every character can reproduce this problem that the IME would not find the correct position.

marijnh commented 4 months ago

For me, using Chrome 126 with simplified Chinese IME, typing zhongwen + space in the editor on codemirror.net gives 中文, which looks reasonable. Is there anything else I should be doing to reproduce the issue?

Arcticn commented 4 months ago

Yes, gives 中文 is correct. However, the problem is when you're typing, the IME keeps jump up and down.My chrome version is 126.0.6478.127, and edge is 126.0.2592.81 Foucs on the IME itself in the video, can you reproduce it?

https://github.com/codemirror/dev/assets/46252987/0b479fff-3e60-492f-ae00-0353bd1cb200

marijnh commented 4 months ago

Oh right, I see what you mean now. That was an obvious bug. Attached patch (released as 6.28.3) should fix it. Not sure how that that wasn't visible on Chrome Linux.

imzbf commented 4 months ago

It seems that this issue still persists, and I am currently using version @codemirror/view@6.28.3.

录屏2024-07-01 17 16 52

Browser and platform

Chrome: 126.0.6478.127 MacOS:14.5 simplified Chinese IME

You can attempt to replicate it in the following online example. https://codesandbox.io/p/devbox/elated-cherry-ph6y5c?file=%2Findex.html%3A21%2C36

And event compositionstart was not triggered correctly too. Is there a problem with my code?

marijnh commented 4 months ago

Are you seeing the incorrectly positioned IME widget problem, or are you seeing another problem?

compositionstart (as well as other composition events) is no longer fired when the editor uses EditContext. You may be able to query CodeMirror's own composing property for a more reliable way to detect composition.

imzbf commented 4 months ago

录屏2024-07-01 17 16 52

Yes, this is a non looping GIF image, it records problem.

marijnh commented 4 months ago

Yes, that looks like the old bug. Is it gone on https://codemirror.net for you?

imzbf commented 4 months ago

Yes, that looks like the old bug. Is it gone on https://codemirror.net for you?

It still appears sometimes

image image
Arcticn commented 4 months ago

It can be 100% reproduced if I try to input enormous characters in the inputbox (In this video, 28000 characters) Again, just try to input zhongwen+space at the end of the input (characters before perform well) in a chromium brower on Windows. Firefox still works well.

https://github.com/codemirror/dev/assets/46252987/698405c5-3087-4080-bb50-78b2dbc3a9ce

mingchiuli commented 4 months ago

It happen on Chrome. Firefox is normal.

marijnh commented 4 months ago

I think I managed to reproduce the issue visible in your screencast. Try again with 6.28.4.

The IME interface appearing the wrong place happens for me when I start the composition at the start of a line. I verified that CodeMirror is giving the correct coordinates to the browser when this happens, so I suspect that is a Chrome bug. I'll spend some more time trying to reproduce and report that later.

Arcticn commented 4 months ago

Sure, the problem with long article is fixed and the other problem remains, thanks for your work!

marijnh commented 4 months ago

I've reported this in the Chrome tracker as #351029417. Sometimes clicking the +1 button at the top of an issue there helps get attention to it.

amoydavid commented 4 months ago

I encountered the same issue on Mac. The phenomenon I observed is that in Chrome with CodeMirror 6, the Chinese input method hint box moves to the upper left with input. The same browser behaves normally with CodeMirror 5. CodeMirror 6 with Safari is also normal.

Rainer-Yu commented 4 months ago

126.0.6478.183 (arm64) macOS Sequoia Beta 15.0 (24A5298h) System built-in Simplified Pinyin IME

image image
orzass commented 3 months ago

WX20240803-151144@2x

Microsoft Edge 127.0.2651.74 (arm64) macos sonoma 14.5 sougou pinyin IME

it still happen.

marijnh commented 3 months ago

I'm aware it is still happening. See the Chrome issue I linked above. That has not been fixed that.

marijnh commented 2 months ago

A fix has been merged for Chrome. I'm not sure which version it'll appear in, but I'm going to close this, since I don't see anything more that can be done from my side.