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

CJK IME: In the parameter brackets of an expression, the first character entered will be repeated #8227

Open
XHXIAIEIN opened this issue Sep 17, 2024 · 3 comments
Assignees

Comments

@XHXIAIEIN
Copy link

XHXIAIEIN commented Sep 17, 2024

Problem description

This question is a secondary question caused by the #7988

In the parameter brackets of an expression, the first character entered will be duplicate. It is reproduced anywhere non-English string When using IME.

Snipaste_2024-09-17_18-08-57

a possible line of investigation:
https://developer.mozilla.org/en-US/docs/Web/API/Element/compositionstart_event

Attach a .c3p

issue-ime2.c3p.zip

Steps to reproduce

Any expression can be reproduced, use IME to input any characters in brackets.
Note: | indicates the position of the cursor

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

Observed result

input: jing
Observed: jjing

Snipaste_2024-09-17_18-08-57
Snipaste_2024-09-17_18-09-20 Snipaste_2024-09-17_18-09-34

Expected result

no additional repeated characters

More details

Affected browsers/platforms:

First affected release:

System details

View details

PASTE HERE

@AshleyScirra
Copy link
Member

I'm afraid I can't reproduce this. Normally I test IME issues using the Windows emoji picker, as that appears to fire the same compositionstart/end events as IME uses. If I follow these steps:

  1. Type abs(
  2. Press Windows + . to show emoji picker
  3. Choose 😀 from picker

Then it correctly enters abs(😀 - there is no duplication. I verified it is firing compositionstart/end events so it doesn't appear those are doing anything wrong.

The input is in fact a contenteditable field and the browser itself handles entering characters - Construct only responds to the entered input and doesn't handle actually adding characters itself (unless you do something like choose an expression from the Expressions Dictionary or select an autocomplete suggestion). So it may be a browser bug or issue with the type of IME you are using.

Do you have any further advice on how to reproduce the problem?

@XHXIAIEIN
Copy link
Author

XHXIAIEIN commented Oct 24, 2024

I tried it and the error still occurs. The steps to reproduce are not like this

1 Open Settings Time & language
image

2 Add a language.
image

3 Search 'Chinese' and select the first one
image

4 You don't need to check them.
image

5 Download...
image

6 Press Windows + space to toggle IME, Or click this icon in the taskbar.
image

7 Then you will see an icon like this, indicating that you have switched to the Pinyin IME.
image

8 If you want to toggle English, you can press Shift to switch between Chinese and English.
image


Let's return to this issues again.

1 It needs to be in closed brackets.
image

2 input 'jing', it will become 'jjing'
image

@XHXIAIEIN
Copy link
Author

XHXIAIEIN commented Oct 24, 2024

I think another possible solution to investigate is to design "throttle" and "debounce" functions the input events.
https://medium.com/@mujaffarhssn/debouncing-vs-throttling-optimizing-your-javascript-for-performance-a99d38f5eb3b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants