Construct-bugs icon indicating copy to clipboard operation
Construct-bugs copied to clipboard

autocomplete will incorrectly apply expressions in CJK language IME

Open XHXIAIEIN opened this issue 1 year ago • 3 comments

Problem description

Entering an expression into the CJK input method may cause AutoComplete to incorrectly to select.

Attach a .c3p

issue-autocomplete-ime.c3p.zip

Steps to reproduce

For example, there is a instance variable named 序号(xuhao) in Chinese.

  1. input Sprite. display the autocomplete list.
Snipaste_2024-05-07_00-12-00
  1. input 序号 use IME. note: You can directly paste the 序号 into the input box. This operation does not affect the reproduction results.
Snipaste_2024-05-07_00-12-35
  1. Note that autocomplete has not been updated at this time. If any key is pressed in this state( Enter or + or -), it will cause the first expression in the selection list to be automatically completed.
Snipaste_2024-05-07_00-16-08

Observed result

Autocomplete will automatically apply the first one in the expression list.

Note that this problem only occurs when the autocomplete list appears. Or in the process of input the . this expression has been selected in the autocomplete list, then it will work normally.

The following two situations can work normally:

Snipaste_2024-05-07_19-54-23 Snipaste_2024-05-07_19-54-23

Expected result

works as expected.

More details

Affected browsers/platforms:

First affected release:

System details

View details

PASTE HERE

XHXIAIEIN avatar May 06 '24 16:05 XHXIAIEIN

I don't know if this helps, maybe this can be used to solve the problem: https://developer.mozilla.org/en-US/docs/Web/API/Element/compositionstart_event

Observed result

你好

compositionstart: 
compositionupdate: n
compositionupdate: ni
compositionupdate: ni'h
compositionupdate: ni'ha
compositionupdate: ni'hao
compositionupdate: 你好
compositionend: 你好

the 'compositionend' is the input result using IME

XHXIAIEIN avatar May 13 '24 02:05 XHXIAIEIN

I have long been troubled by similar issues unrelated to Chinese or IME. 6FHPKIT %(T92A)EGXEX59X When I type "&newline&", a selection box highlighting my "Name....." item pops up, which is normal. However, even after typing "&newline" and it turning blue, the system still automatically rewrites to me when I type in an “&”. {S6{AAYZ_0P OOWE3X$BAQM Please refer to the pic ↑ Hope C3 can do better and better :)

imKiBi avatar May 14 '24 07:05 imKiBi

I've also been experiencing this issue, where searching with Chinese input is problematic. I really hope the official team can address this matter.

6969

6969

r2680143448 avatar Aug 14 '24 13:08 r2680143448

This is tricky to test because unfortunately I'm not familiar with Chinese or entering text via IME. However it looks like the Windows emoji picker (opened with Windows + .) is a type of IME entry which also fires composition events. So it seems this may be a good way to test it, using emoji in place of Chinese characters: so long as it autocompletes correctly with the emoji picker, then I think that means IME should work with other languages too.

I was able to use the emoji-picker approach to reproduce two variants of this issue: the originally noted one involving typing Sprite. followed by IME entry, and another using IME to refer to an object name (i.e. global namespace autocomplete). Hopefully this solves the problem, but I'm marking this issue as to check in the next release so others can verify how it works with IME entry for other languages like Chinese.

AshleyScirra avatar Aug 30 '24 11:08 AshleyScirra

r405 is now out with improvements for IME. Does it work better there now?

AshleyScirra avatar Sep 03 '24 13:09 AshleyScirra

Yes, it is work better now! I gave it a quick try and it did solve the problem, thanks you!

XHXIAIEIN avatar Sep 03 '24 15:09 XHXIAIEIN

There is another issue: Asian symbols do not trigger autocompletion

(r190) Expressions can now use Asian characters as equivalents for latin operators: ,。“”()?:

  1. input 'Sprite', and cancel autocompletion
  2. input '.' or '。'
use . use
Snipaste_2024-09-13_16-26-20 Snipaste_2024-09-13_16-27-10
Observed: show Sprite('精灵') expression Observed: show System expression







Another addition about Asian symbol support(off topic) About the double quotes of Asian symbols, the quotes in Asian languages ​​are composed of 2 different symbols“”. they exist in the same way as brackets (). Currently only 2 identical characters are allowed, either a left quote““ or a right quote””. But in Asian writing conventions this is counter-intuitive. It would be more consistent with usage habits if more support could be provided for them.

expected:  “string”
Current:  “string“   or   ”string”

XHXIAIEIN avatar Sep 04 '24 05:09 XHXIAIEIN

other issue: In the parameter brackets of an expression, the first character entered will be repeated

image

Steps to reproduce:

  1. abs()|
  2. abs(|)
  3. abs(qu|)
  4. it will automatically become abs(qqu|)

image

XHXIAIEIN avatar Sep 16 '24 14:09 XHXIAIEIN

I believe the issue described in the original report is now fixed. If there are other issues to follow up it would be best to file them separately, as issues need to be tracked separately and also include full details with each report.

AshleyScirra avatar Sep 17 '24 09:09 AshleyScirra