ollama-gui
ollama-gui copied to clipboard
Fix Chinese input method bug
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 thekeydown
event handler to ensure that the input content is not submitted during Chinese input. - Updated the
flag
variable in thecompositionstart
andcompositionend
event handlers.
Verification
- Input some text using the Chinese input method.
- Press the Enter key to ensure the input content does not get lost.
- Wait for the input to complete, then press the Enter key again to ensure the input content is correctly submitted.