ollama-gui icon indicating copy to clipboard operation
ollama-gui copied to clipboard

Fix Chinese input method bug

Open axliupore opened this issue 6 months ago • 0 comments

Description

When using the Chinese input method, pressing the Enter key during input caused the input content to be lost. This issue occurred because pressing Enter during Chinese input directly submitted the input content instead of waiting for the input to complete.

Solution

By adding a flag variable to control whether submission is allowed and updating this variable in the compositionstart and compositionend events, we ensure that the input content is only submitted after the Chinese input is complete.

Changes

  • Added a flag variable to control whether submission is allowed.
  • Checked the flag variable in the keydown event handler to ensure that the input content is not submitted during Chinese input.
  • Updated the flag variable in the compositionstart and compositionend event handlers.

Verification

  1. Input some text using the Chinese input method.
  2. Press the Enter key to ensure the input content does not get lost.
  3. Wait for the input to complete, then press the Enter key again to ensure the input content is correctly submitted.

axliupore avatar Aug 20 '24 02:08 axliupore