Skip to content

Fix text-input Chinese input #808

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

qingyiwebt
Copy link

Now IME is allowed for the window winit created, and the text input can handle the ImeCommit event,
BUT the render issue when there is CJK text in the text-input still exists.

@qingyiwebt
Copy link
Author

QQ2025430-231030-HD.mp4

@dzhou121
Copy link
Contributor

dzhou121 commented Apr 30, 2025

We probably should call set_ime_allowed(true) when text input is in focus, and set_ime_allowed(false) when it's out of focus.

https://github.com/lapce/floem/blob/main/src/action.rs#L213

And call set_ime_cursor_area to put the IME candidate box.

@qingyiwebt
Copy link
Author

qingyiwebt commented Apr 30, 2025

Ok, I will try to solve it tomorrow.

@qingyiwebt
Copy link
Author

qingyiwebt commented Apr 30, 2025

The calling of set_ime_cursor_area and some fixes is also added in the commit enable IME when text-input focused

@qingyiwebt
Copy link
Author

qingyiwebt commented May 1, 2025

Now text-input should work better with CJK characters and IME, the text overflow problem and cursor position should be fixed too.

QQ202551-125246-HD.mp4

image

id.update_state((text, is_focused.get()));
let is_focused = is_focused.get();
id.update_state((text, is_focused));
set_ime_allowed(is_focused);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There could be issue when the focus is switched from one text input to another, and we can't guarantee the execution order of the set_ime_allowed, so when the loosing focus text input execute this later than the gaining focus one, the ime would be disallowed. We need a central state of whether ime should be allowed.

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

Successfully merging this pull request may close these issues.

2 participants